rerobe-js-orm 4.9.6 → 4.9.8
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/lib/helpers/OrderHelpers.js +4 -3
- package/lib/helpers/ReceiptXmlHelpers.d.ts +6 -0
- package/lib/helpers/ReceiptXmlHelpers.js +235 -0
- package/lib/helpers/ReturnPolicyHelpers.d.ts +1 -1
- package/lib/helpers/ReturnPolicyHelpers.js +7 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/translations.d.ts +3 -0
- package/lib/translations.js +11 -1
- package/package.json +1 -1
|
@@ -693,11 +693,12 @@ class OrderHelpers {
|
|
|
693
693
|
}
|
|
694
694
|
let info = additionalInfo;
|
|
695
695
|
// Derive the return-policy line from the structured policy for the order's
|
|
696
|
-
// sales channel
|
|
697
|
-
// shown on refund receipts.
|
|
696
|
+
// sales channel, localized to the receipt's presentment locale (legacy
|
|
697
|
+
// free-text policies pass through unchanged). Never shown on refund receipts.
|
|
698
|
+
const returnPolicyTemplate = translations_1.returnPolicyReceiptTranslations[presentmentLocale] || translations_1.returnPolicyReceiptTranslations['en-US'];
|
|
698
699
|
const returnPolicyText = isRefund
|
|
699
700
|
? ''
|
|
700
|
-
: ReturnPolicyHelpers_1.default.returnPolicyReceiptText(returnPolicy, (_d = order.salesChannel) !== null && _d !== void 0 ? _d : undefined);
|
|
701
|
+
: ReturnPolicyHelpers_1.default.returnPolicyReceiptText(returnPolicy, (_d = order.salesChannel) !== null && _d !== void 0 ? _d : undefined, returnPolicyTemplate);
|
|
701
702
|
if (returnPolicyText) {
|
|
702
703
|
info = returnPolicyText;
|
|
703
704
|
if (additionalInfo) {
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ePOS-Print (Epson) receipt XML builder — the exact payload sent to the
|
|
3
|
+
// receipt printer server (printer.ribbn-receipts.com). Ported verbatim from the
|
|
4
|
+
// backend printerUtils so the live print path, per-partner receipts, and the
|
|
5
|
+
// admin simulators all render byte-identical XML from a single source.
|
|
6
|
+
// Pure + dependency-free (escapeXML matches lodash `escape` for & < > " ').
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
const ProductVariantHelpers_1 = require("./ProductVariantHelpers");
|
|
9
|
+
class ReceiptXmlHelpers {
|
|
10
|
+
// Byte-identical to lodash `escape`: escapes & < > " ' and nothing else.
|
|
11
|
+
static escapeXML(text) {
|
|
12
|
+
if (!text)
|
|
13
|
+
return '';
|
|
14
|
+
return String(text)
|
|
15
|
+
.replace(/&/g, '&')
|
|
16
|
+
.replace(/</g, '<')
|
|
17
|
+
.replace(/>/g, '>')
|
|
18
|
+
.replace(/"/g, '"')
|
|
19
|
+
.replace(/'/g, ''');
|
|
20
|
+
}
|
|
21
|
+
// Variant label for a receipt line (e.g. "M · R"), delegated to the shared
|
|
22
|
+
// helper so cart, order detail, and receipt render the same rule.
|
|
23
|
+
static variantLabelForReceipt(lineItem) {
|
|
24
|
+
return ProductVariantHelpers_1.default.variantLabel(lineItem);
|
|
25
|
+
}
|
|
26
|
+
// Formats a line item into ePOS-Print XML (title left, price right, optional
|
|
27
|
+
// indented variant sub-line).
|
|
28
|
+
static formatLineItemXML(lineItem) {
|
|
29
|
+
const maxLineLength = 42;
|
|
30
|
+
const leftColumnWidth = 28;
|
|
31
|
+
const rightColumnWidth = maxLineLength - leftColumnWidth;
|
|
32
|
+
const rawLeftText = String(lineItem.title || '');
|
|
33
|
+
const rawRightText = String(lineItem.price || '');
|
|
34
|
+
let formattedLeftText = rawLeftText;
|
|
35
|
+
if (rawLeftText.length > leftColumnWidth) {
|
|
36
|
+
formattedLeftText = `${rawLeftText.substring(0, leftColumnWidth - 3)}...`;
|
|
37
|
+
}
|
|
38
|
+
let formattedRightText = rawRightText;
|
|
39
|
+
if (rawRightText.length > rightColumnWidth) {
|
|
40
|
+
formattedRightText = rawRightText.substring(0, rightColumnWidth);
|
|
41
|
+
}
|
|
42
|
+
const escapedLeftText = this.escapeXML(formattedLeftText);
|
|
43
|
+
const escapedRightText = this.escapeXML(formattedRightText);
|
|
44
|
+
let spaceCount = maxLineLength - formattedLeftText.length - formattedRightText.length;
|
|
45
|
+
const swedishChars = (escapedLeftText.match(/[åäö]/g) || []).length;
|
|
46
|
+
spaceCount -= swedishChars;
|
|
47
|
+
if (spaceCount < 0) {
|
|
48
|
+
spaceCount = 1;
|
|
49
|
+
}
|
|
50
|
+
const spacesBetween = ' '.repeat(spaceCount);
|
|
51
|
+
let lineXml = `<text>${escapedLeftText}${spacesBetween}${escapedRightText}</text><feed/>`;
|
|
52
|
+
const variantLabel = this.variantLabelForReceipt(lineItem);
|
|
53
|
+
if (variantLabel) {
|
|
54
|
+
let variantLine = ` ${variantLabel}`;
|
|
55
|
+
if (variantLine.length > maxLineLength) {
|
|
56
|
+
variantLine = `${variantLine.substring(0, maxLineLength - 3)}...`;
|
|
57
|
+
}
|
|
58
|
+
lineXml += `<text>${this.escapeXML(variantLine)}</text><feed/>`;
|
|
59
|
+
}
|
|
60
|
+
return lineXml;
|
|
61
|
+
}
|
|
62
|
+
// Builds a complete receipt in ePOS-Print XML format from a receiptData
|
|
63
|
+
// object (the output of OrderHelpers.buildReceiptObjFromOrder / ReceiptBuilder).
|
|
64
|
+
static buildReceiptContentXML(receiptData) {
|
|
65
|
+
let receipt = '<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">';
|
|
66
|
+
receipt += '<text align="center"/>';
|
|
67
|
+
if (receiptData.merchantLogoUrl) {
|
|
68
|
+
// Handle image printing if required
|
|
69
|
+
}
|
|
70
|
+
receipt += '<text font="font_a" width="2" height="2">';
|
|
71
|
+
receipt += this.escapeXML(receiptData.merchantName);
|
|
72
|
+
receipt += '</text><feed/>';
|
|
73
|
+
if (receiptData.organizationNumber) {
|
|
74
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
75
|
+
receipt += `Org.nr: ${this.escapeXML(receiptData.organizationNumber)}`;
|
|
76
|
+
receipt += '</text><feed/>';
|
|
77
|
+
}
|
|
78
|
+
receipt += '<feed/>';
|
|
79
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
80
|
+
receipt += this.escapeXML(receiptData.storeAddress);
|
|
81
|
+
receipt += '</text><feed/>';
|
|
82
|
+
receipt += '<text font="font_a" width="2" height="2">';
|
|
83
|
+
receipt += `${this.escapeXML(receiptData.receiptLabel)} # ${this.escapeXML(receiptData.receiptNumber)}`;
|
|
84
|
+
receipt += '</text><feed/>';
|
|
85
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
86
|
+
receipt += this.escapeXML(receiptData.orderDate);
|
|
87
|
+
receipt += '</text><feed/>';
|
|
88
|
+
if (receiptData.isRefund && receiptData.originalReceiptNumber) {
|
|
89
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
90
|
+
receipt += `${this.escapeXML(receiptData.originalReceiptLabel || 'Original receipt')}: ${this.escapeXML(receiptData.originalReceiptNumber)}`;
|
|
91
|
+
receipt += '</text><feed/>';
|
|
92
|
+
}
|
|
93
|
+
receipt += '<feed/>';
|
|
94
|
+
receipt += '<text>----------------------------------------</text><feed/>';
|
|
95
|
+
receiptData.lineItems.forEach((item) => {
|
|
96
|
+
receipt += this.formatLineItemXML(item);
|
|
97
|
+
});
|
|
98
|
+
receipt += '<text>----------------------------------------</text><feed/><feed/>';
|
|
99
|
+
receipt += '<text font="font_a" width="1" height="1" em="true">';
|
|
100
|
+
const totalDisplay = receiptData.totalFormatted ||
|
|
101
|
+
(typeof receiptData.total === 'number'
|
|
102
|
+
? `${(receiptData.total / 100).toFixed(2).replace('.', ',')} kr`
|
|
103
|
+
: receiptData.total);
|
|
104
|
+
receipt += `${this.escapeXML(receiptData.totalLabel)}: ${this.escapeXML(totalDisplay)}`;
|
|
105
|
+
receipt += '</text><feed/>';
|
|
106
|
+
if (receiptData.totalRefunded) {
|
|
107
|
+
receipt += '<feed/>';
|
|
108
|
+
receipt += '<text>----------------------------------------</text><feed/>';
|
|
109
|
+
receipt += '<text font="font_a" width="1" height="1" em="true">';
|
|
110
|
+
receipt += 'RETUR';
|
|
111
|
+
receipt += '</text><feed/>';
|
|
112
|
+
receipt += '<text font="font_a" width="1" height="1" em="false">';
|
|
113
|
+
receipt += '</text>';
|
|
114
|
+
if (receiptData.refundLineItems && receiptData.refundLineItems.length > 0) {
|
|
115
|
+
receiptData.refundLineItems.forEach((item) => {
|
|
116
|
+
receipt += this.formatLineItemXML(item);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
120
|
+
receipt += `Refunded: ${this.escapeXML(receiptData.totalRefunded)}`;
|
|
121
|
+
receipt += '</text><feed/>';
|
|
122
|
+
if (receiptData.netPayment) {
|
|
123
|
+
receipt += '<text font="font_a" width="1" height="1" em="true">';
|
|
124
|
+
receipt += `Net Payment: ${this.escapeXML(receiptData.netPayment)}`;
|
|
125
|
+
receipt += '</text><feed/>';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
receipt += '<feed/>';
|
|
129
|
+
receipt += '<text font="font_a" width="1" height="1" em="false">';
|
|
130
|
+
receipt += '</text>';
|
|
131
|
+
if (receiptData.taxRates && typeof receiptData.taxRates === 'object') {
|
|
132
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
133
|
+
Object.entries(receiptData.taxRates).forEach(([taxRate, value]) => {
|
|
134
|
+
const rate = parseFloat(String(taxRate).trim());
|
|
135
|
+
receipt += `Moms ${this.escapeXML(String(rate))}%: ${this.escapeXML(value)}`;
|
|
136
|
+
receipt += '</text><feed/><text font="font_a" width="1" height="1">';
|
|
137
|
+
});
|
|
138
|
+
receipt += '</text><feed/>';
|
|
139
|
+
}
|
|
140
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
141
|
+
receipt += this.escapeXML(receiptData.purchaseLabel);
|
|
142
|
+
receipt += '</text><feed/><text font="font_a" width="1" height="1">';
|
|
143
|
+
receipt += this.escapeXML(receiptData.paymentMethodLabel);
|
|
144
|
+
receipt += '</text><feed/><text font="font_a" width="1" height="1">';
|
|
145
|
+
const paymentTotalDisplay = receiptData.totalFormatted ||
|
|
146
|
+
(typeof receiptData.total === 'number'
|
|
147
|
+
? `${(receiptData.total / 100).toFixed(2).replace('.', ',')} kr`
|
|
148
|
+
: receiptData.total);
|
|
149
|
+
receipt += `Total: ${this.escapeXML(paymentTotalDisplay)}`;
|
|
150
|
+
receipt += '</text><feed/>';
|
|
151
|
+
if (receiptData.applicationName && receiptData.lastFour) {
|
|
152
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
153
|
+
receipt += `${this.escapeXML(receiptData.applicationName)} **** **** ${this.escapeXML(receiptData.lastFour)}`;
|
|
154
|
+
receipt += '</text><feed/>';
|
|
155
|
+
}
|
|
156
|
+
if (receiptData.entryMode) {
|
|
157
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
158
|
+
receipt += `Entry Mode: ${this.escapeXML(receiptData.entryMode)}`;
|
|
159
|
+
receipt += '</text><feed/>';
|
|
160
|
+
}
|
|
161
|
+
if (receiptData.aid) {
|
|
162
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
163
|
+
receipt += `AID: ${this.escapeXML(receiptData.aid)}`;
|
|
164
|
+
receipt += '</text><feed/>';
|
|
165
|
+
}
|
|
166
|
+
if (receiptData.tvr) {
|
|
167
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
168
|
+
receipt += `TVR: ${this.escapeXML(receiptData.tvr)}`;
|
|
169
|
+
receipt += '</text><feed/>';
|
|
170
|
+
}
|
|
171
|
+
if (receiptData.authorizationCode) {
|
|
172
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
173
|
+
receipt += `Authorization Code: ${this.escapeXML(receiptData.authorizationCode)}`;
|
|
174
|
+
receipt += '</text><feed/>';
|
|
175
|
+
}
|
|
176
|
+
if (receiptData.referenceNumber) {
|
|
177
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
178
|
+
receipt += `Reference Number: ${this.escapeXML(receiptData.referenceNumber)}`;
|
|
179
|
+
receipt += '</text><feed/>';
|
|
180
|
+
}
|
|
181
|
+
if (receiptData.additionalInfo) {
|
|
182
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
183
|
+
receipt += this.escapeXML(receiptData.additionalInfo);
|
|
184
|
+
receipt += '</text><feed/>';
|
|
185
|
+
}
|
|
186
|
+
receipt += '<feed/>';
|
|
187
|
+
if (receiptData.legalName) {
|
|
188
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
189
|
+
receipt += this.escapeXML(receiptData.legalName);
|
|
190
|
+
receipt += '</text><feed/>';
|
|
191
|
+
}
|
|
192
|
+
if (receiptData.phone) {
|
|
193
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
194
|
+
receipt += this.escapeXML(receiptData.phone);
|
|
195
|
+
receipt += '</text><feed/>';
|
|
196
|
+
}
|
|
197
|
+
if (receiptData.primaryDomain) {
|
|
198
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
199
|
+
receipt += this.escapeXML(receiptData.primaryDomain);
|
|
200
|
+
receipt += '</text><feed/>';
|
|
201
|
+
}
|
|
202
|
+
if (receiptData.contactEmail) {
|
|
203
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
204
|
+
receipt += this.escapeXML(receiptData.contactEmail);
|
|
205
|
+
receipt += '</text><feed/>';
|
|
206
|
+
}
|
|
207
|
+
if (receiptData.organizationNumber) {
|
|
208
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
209
|
+
receipt += `Org. Nr. ${this.escapeXML(receiptData.organizationNumber)}`;
|
|
210
|
+
receipt += '</text><feed/>';
|
|
211
|
+
}
|
|
212
|
+
if (receiptData.controlCode) {
|
|
213
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
214
|
+
receipt += `Kontrollkod: ${this.escapeXML(receiptData.controlCode)}`;
|
|
215
|
+
receipt += '</text><feed/>';
|
|
216
|
+
}
|
|
217
|
+
receipt += '<feed/><feed/>';
|
|
218
|
+
receipt += '<feed/>';
|
|
219
|
+
receipt += '<text>----------------------------------------</text><feed/>';
|
|
220
|
+
if (receiptData.terminalName) {
|
|
221
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
222
|
+
receipt += `Terminal: ${this.escapeXML(receiptData.terminalName)}`;
|
|
223
|
+
receipt += '</text><feed/>';
|
|
224
|
+
}
|
|
225
|
+
if (receiptData.controlUnitSerial) {
|
|
226
|
+
receipt += '<text font="font_a" width="1" height="1">';
|
|
227
|
+
receipt += `Kontrollenhet: ${this.escapeXML(receiptData.controlUnitSerial)}`;
|
|
228
|
+
receipt += '</text><feed/>';
|
|
229
|
+
}
|
|
230
|
+
receipt += '<cut type="feed"/>';
|
|
231
|
+
receipt += '</epos-print>';
|
|
232
|
+
return receipt;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.default = ReceiptXmlHelpers;
|
|
@@ -33,7 +33,7 @@ export default class ReturnPolicyHelpers {
|
|
|
33
33
|
soldAtMillis?: number;
|
|
34
34
|
nowMillis?: number;
|
|
35
35
|
}): ReturnEvaluation;
|
|
36
|
-
static returnPolicyReceiptText(raw: any, salesChannel?: string): string;
|
|
36
|
+
static returnPolicyReceiptText(raw: any, salesChannel?: string, template?: string): string;
|
|
37
37
|
static resolveEffectiveReturnPolicy({ ownPolicyRaw, marketplaceDefaultRaw, isManaged, }: {
|
|
38
38
|
ownPolicyRaw?: any;
|
|
39
39
|
marketplaceDefaultRaw?: any;
|
|
@@ -167,7 +167,12 @@ class ReturnPolicyHelpers {
|
|
|
167
167
|
// unchanged. For a structured policy, prefer the sale's channel; without a
|
|
168
168
|
// channel, summarize whichever channel(s) accept returns. Returns '' when
|
|
169
169
|
// there's nothing meaningful to print (no policy, or returns not accepted).
|
|
170
|
-
|
|
170
|
+
// `template` is a per-locale format string with a `{days}` placeholder, e.g.
|
|
171
|
+
// "{days} day return policy" / "{days} dagars öppet köp". Defaults to English
|
|
172
|
+
// so non-receipt callers (admin preview) need not pass one; the receipt
|
|
173
|
+
// builder passes the localized template. Legacy free-text policies pass
|
|
174
|
+
// through unchanged (can't be localized).
|
|
175
|
+
static returnPolicyReceiptText(raw, salesChannel, template = '{days} day return policy') {
|
|
171
176
|
if (typeof raw === 'string')
|
|
172
177
|
return raw.trim();
|
|
173
178
|
const policy = this.parse(raw);
|
|
@@ -176,7 +181,7 @@ class ReturnPolicyHelpers {
|
|
|
176
181
|
const lineFor = (ch) => {
|
|
177
182
|
if (!ch || !ch.allowed || ch.returnPeriodDays <= 0)
|
|
178
183
|
return '';
|
|
179
|
-
return
|
|
184
|
+
return template.replace('{days}', String(ch.returnPeriodDays));
|
|
180
185
|
};
|
|
181
186
|
if (salesChannel) {
|
|
182
187
|
const key = this.channelKeyForSalesChannel(salesChannel);
|
package/lib/index.d.ts
CHANGED
|
@@ -52,11 +52,12 @@ import PricingHelpers from './helpers/PricingHelpers';
|
|
|
52
52
|
import ProductSkuHelpers, { DEFAULT_SKU_LENGTH, SKU_ALPHABET } from './helpers/ProductSkuHelpers';
|
|
53
53
|
import ProductVariantHelpers from './helpers/ProductVariantHelpers';
|
|
54
54
|
import ReturnPolicyHelpers from './helpers/ReturnPolicyHelpers';
|
|
55
|
+
import ReceiptXmlHelpers from './helpers/ReceiptXmlHelpers';
|
|
55
56
|
import ProductInventoryHelpers, { PLACEHOLDER_VARIANT_ID } from './helpers/ProductInventoryHelpers';
|
|
56
57
|
import RetailProductFactory from './factories/Product/RetailProductFactory';
|
|
57
58
|
import { FALLBACK_TAX_COUNTRY_CODE, TAX_CATEGORIES, TAX_CATEGORY_ALIASES, TAX_CATEGORY_BASE_LABELS, TAX_CATEGORY_RATES } from './constants/tax-constants';
|
|
58
59
|
import { ADMIN_SIMPLIFIED_STATES, ADMIN_STATES, PRODUCT_CLASS_VALUES, PRODUCT_STATES, PRODUCT_STATE_LABELS, RETAIL_EDITABLE_PRODUCT_STATES, getProductStateLabel, getRetailEditableProductStateOptions } from './constants/product-constants';
|
|
59
|
-
export { RibbnFile, ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, ProductCollectionFormStateFactory, ProductCollectionHelpers, SellRequestFormStateFactory, PickUpFormStateFactory, AddressFormStateFactory, UserFormStateFactory, UserFromShopifyWebhookJSONDoc, UserFromAuthTemplateMethod, DraftOrderFromMirakl, DraftOrderFromApp, ChatRoomFromNewUserSignUp, KlarnaSessionFactory, Product, ProductStateManager, Order, OrderFromShopifyWebhook, OrderFromShopifyAdminApi, OrderFromShopifyStorefrontApi, OrderFromApp, OrderFromTraderaEmail, OrderFormStateFactory, RefundFormStateFactory, PayoutAccount, PayoutAccountFormState, Merchant, MERCHANT_ACCOUNT_MODES, MERCHANT_ACCOUNT_CLASSES, MERCHANT_RELATIONSHIP_TYPES, MARKETPLACE_SELLER_CAPABILITIES, DEFAULT_MARKETPLACE_SELLER_CAPABILITIES, MerchantFormState, MerchantFormStateFactory, MerchantConfigAutomatedPayouts, MerchantConfigAutomatedPayoutsFormState, ReRobeProductHelpers, MarketplaceProductHelpers, MarketplaceLedgerHelpers, MarketplaceLegacyAdapters, MarketplaceLineDisplayHelpers, MarketplaceOrderHelpers, MARKETPLACE_LISTING_STATUSES, MARKETPLACE_COMMISSION_BASES, MARKETPLACE_RELATIONSHIP_TYPES, MARKETPLACE_FEE_TYPES, MARKETPLACE_FEE_ALLOCATION_BASES, MARKETPLACE_LEDGER_STATUSES, MARKETPLACE_INVENTORY_POLICY_KINDS, MARKETPLACE_SELLER_DEFAULT_COMMISSION, STOCK_STATUSES, DEFAULT_MARKETPLACE_LISTING_STATUS, DEFAULT_MARKETPLACE_COMMISSION_BASIS, DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE, DEFAULT_STRIPE_FEE_ALLOCATION_BASIS, DEFAULT_RIBBN_FEE_ALLOCATION_BASIS, DEFAULT_MARKETPLACE_LEDGER_STATUS, User, AnalyticsHelpers, OrderHelpers, WebhookFormState, MerchantWebPage, ShopifyMerchantAccount, CustomerNotification, TaxHelpers, PricingHelpers, ProductSkuHelpers, ProductVariantHelpers, ReturnPolicyHelpers, ProductInventoryHelpers, RetailProductFactory, SKU_ALPHABET, DEFAULT_SKU_LENGTH, PLACEHOLDER_VARIANT_ID, TAX_CATEGORIES, TAX_CATEGORY_RATES, TAX_CATEGORY_BASE_LABELS, TAX_CATEGORY_ALIASES, FALLBACK_TAX_COUNTRY_CODE, PRODUCT_STATES, PRODUCT_STATE_LABELS, PRODUCT_CLASS_VALUES, ADMIN_STATES, ADMIN_SIMPLIFIED_STATES, RETAIL_EDITABLE_PRODUCT_STATES, getProductStateLabel, getRetailEditableProductStateOptions, };
|
|
60
|
+
export { RibbnFile, ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, ProductCollectionFormStateFactory, ProductCollectionHelpers, SellRequestFormStateFactory, PickUpFormStateFactory, AddressFormStateFactory, UserFormStateFactory, UserFromShopifyWebhookJSONDoc, UserFromAuthTemplateMethod, DraftOrderFromMirakl, DraftOrderFromApp, ChatRoomFromNewUserSignUp, KlarnaSessionFactory, Product, ProductStateManager, Order, OrderFromShopifyWebhook, OrderFromShopifyAdminApi, OrderFromShopifyStorefrontApi, OrderFromApp, OrderFromTraderaEmail, OrderFormStateFactory, RefundFormStateFactory, PayoutAccount, PayoutAccountFormState, Merchant, MERCHANT_ACCOUNT_MODES, MERCHANT_ACCOUNT_CLASSES, MERCHANT_RELATIONSHIP_TYPES, MARKETPLACE_SELLER_CAPABILITIES, DEFAULT_MARKETPLACE_SELLER_CAPABILITIES, MerchantFormState, MerchantFormStateFactory, MerchantConfigAutomatedPayouts, MerchantConfigAutomatedPayoutsFormState, ReRobeProductHelpers, MarketplaceProductHelpers, MarketplaceLedgerHelpers, MarketplaceLegacyAdapters, MarketplaceLineDisplayHelpers, MarketplaceOrderHelpers, MARKETPLACE_LISTING_STATUSES, MARKETPLACE_COMMISSION_BASES, MARKETPLACE_RELATIONSHIP_TYPES, MARKETPLACE_FEE_TYPES, MARKETPLACE_FEE_ALLOCATION_BASES, MARKETPLACE_LEDGER_STATUSES, MARKETPLACE_INVENTORY_POLICY_KINDS, MARKETPLACE_SELLER_DEFAULT_COMMISSION, STOCK_STATUSES, DEFAULT_MARKETPLACE_LISTING_STATUS, DEFAULT_MARKETPLACE_COMMISSION_BASIS, DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE, DEFAULT_STRIPE_FEE_ALLOCATION_BASIS, DEFAULT_RIBBN_FEE_ALLOCATION_BASIS, DEFAULT_MARKETPLACE_LEDGER_STATUS, User, AnalyticsHelpers, OrderHelpers, WebhookFormState, MerchantWebPage, ShopifyMerchantAccount, CustomerNotification, TaxHelpers, PricingHelpers, ProductSkuHelpers, ProductVariantHelpers, ReturnPolicyHelpers, ReceiptXmlHelpers, ProductInventoryHelpers, RetailProductFactory, SKU_ALPHABET, DEFAULT_SKU_LENGTH, PLACEHOLDER_VARIANT_ID, TAX_CATEGORIES, TAX_CATEGORY_RATES, TAX_CATEGORY_BASE_LABELS, TAX_CATEGORY_ALIASES, FALLBACK_TAX_COUNTRY_CODE, PRODUCT_STATES, PRODUCT_STATE_LABELS, PRODUCT_CLASS_VALUES, ADMIN_STATES, ADMIN_SIMPLIFIED_STATES, RETAIL_EDITABLE_PRODUCT_STATES, getProductStateLabel, getRetailEditableProductStateOptions, };
|
|
60
61
|
export type { PlaceholderVariantInput, PlaceholderVariantInventory, PlaceholderVariantLocation, } from './helpers/ProductInventoryHelpers';
|
|
61
62
|
export type { RetailOwnershipInput, RetailAccountingInput, RetailLocationInput, ClothingDetailsInput, NonClothingDetailsInput, OneOfAKindClothingInput, MultivariantClothingInput, TrackedRetailInput, UntrackedRetailInput, } from './factories/Product/RetailProductFactory';
|
|
62
63
|
export type { TaxCategoryValue } from './constants/tax-constants';
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MARKETPLACE_FEE_ALLOCATION_BASES = exports.MARKETPLACE_FEE_TYPES = exports.MARKETPLACE_RELATIONSHIP_TYPES = exports.MARKETPLACE_COMMISSION_BASES = exports.MARKETPLACE_LISTING_STATUSES = exports.MarketplaceOrderHelpers = exports.MarketplaceLineDisplayHelpers = exports.MarketplaceLegacyAdapters = exports.MarketplaceLedgerHelpers = exports.MarketplaceProductHelpers = exports.ReRobeProductHelpers = exports.MerchantConfigAutomatedPayoutsFormState = exports.MerchantConfigAutomatedPayouts = exports.MerchantFormStateFactory = exports.MerchantFormState = exports.DEFAULT_MARKETPLACE_SELLER_CAPABILITIES = exports.MARKETPLACE_SELLER_CAPABILITIES = exports.MERCHANT_RELATIONSHIP_TYPES = exports.MERCHANT_ACCOUNT_CLASSES = exports.MERCHANT_ACCOUNT_MODES = exports.Merchant = exports.PayoutAccountFormState = exports.PayoutAccount = exports.RefundFormStateFactory = exports.OrderFormStateFactory = exports.OrderFromTraderaEmail = exports.OrderFromApp = exports.OrderFromShopifyStorefrontApi = exports.OrderFromShopifyAdminApi = exports.OrderFromShopifyWebhook = exports.Order = exports.ProductStateManager = exports.Product = exports.KlarnaSessionFactory = exports.ChatRoomFromNewUserSignUp = exports.DraftOrderFromApp = exports.DraftOrderFromMirakl = exports.UserFromAuthTemplateMethod = exports.UserFromShopifyWebhookJSONDoc = exports.UserFormStateFactory = exports.AddressFormStateFactory = exports.PickUpFormStateFactory = exports.SellRequestFormStateFactory = exports.ProductCollectionHelpers = exports.ProductCollectionFormStateFactory = exports.ProductFormStateFactory = exports.ProductFromShopifyJSClientJSONDoc = exports.ProductFromShopifyWebhookJSONDoc = exports.ProductFromAlgoliaJSONDoc = exports.RibbnFile = void 0;
|
|
4
|
-
exports.getRetailEditableProductStateOptions = exports.getProductStateLabel = exports.RETAIL_EDITABLE_PRODUCT_STATES = exports.ADMIN_SIMPLIFIED_STATES = exports.ADMIN_STATES = exports.PRODUCT_CLASS_VALUES = exports.PRODUCT_STATE_LABELS = exports.PRODUCT_STATES = exports.FALLBACK_TAX_COUNTRY_CODE = exports.TAX_CATEGORY_ALIASES = exports.TAX_CATEGORY_BASE_LABELS = exports.TAX_CATEGORY_RATES = exports.TAX_CATEGORIES = exports.PLACEHOLDER_VARIANT_ID = exports.DEFAULT_SKU_LENGTH = exports.SKU_ALPHABET = exports.RetailProductFactory = exports.ProductInventoryHelpers = exports.ReturnPolicyHelpers = exports.ProductVariantHelpers = exports.ProductSkuHelpers = exports.PricingHelpers = exports.TaxHelpers = exports.CustomerNotification = exports.ShopifyMerchantAccount = exports.MerchantWebPage = exports.WebhookFormState = exports.OrderHelpers = exports.AnalyticsHelpers = exports.User = exports.DEFAULT_MARKETPLACE_LEDGER_STATUS = exports.DEFAULT_RIBBN_FEE_ALLOCATION_BASIS = exports.DEFAULT_STRIPE_FEE_ALLOCATION_BASIS = exports.DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE = exports.DEFAULT_MARKETPLACE_COMMISSION_BASIS = exports.DEFAULT_MARKETPLACE_LISTING_STATUS = exports.STOCK_STATUSES = exports.MARKETPLACE_SELLER_DEFAULT_COMMISSION = exports.MARKETPLACE_INVENTORY_POLICY_KINDS = exports.MARKETPLACE_LEDGER_STATUSES = void 0;
|
|
4
|
+
exports.getRetailEditableProductStateOptions = exports.getProductStateLabel = exports.RETAIL_EDITABLE_PRODUCT_STATES = exports.ADMIN_SIMPLIFIED_STATES = exports.ADMIN_STATES = exports.PRODUCT_CLASS_VALUES = exports.PRODUCT_STATE_LABELS = exports.PRODUCT_STATES = exports.FALLBACK_TAX_COUNTRY_CODE = exports.TAX_CATEGORY_ALIASES = exports.TAX_CATEGORY_BASE_LABELS = exports.TAX_CATEGORY_RATES = exports.TAX_CATEGORIES = exports.PLACEHOLDER_VARIANT_ID = exports.DEFAULT_SKU_LENGTH = exports.SKU_ALPHABET = exports.RetailProductFactory = exports.ProductInventoryHelpers = exports.ReceiptXmlHelpers = exports.ReturnPolicyHelpers = exports.ProductVariantHelpers = exports.ProductSkuHelpers = exports.PricingHelpers = exports.TaxHelpers = exports.CustomerNotification = exports.ShopifyMerchantAccount = exports.MerchantWebPage = exports.WebhookFormState = exports.OrderHelpers = exports.AnalyticsHelpers = exports.User = exports.DEFAULT_MARKETPLACE_LEDGER_STATUS = exports.DEFAULT_RIBBN_FEE_ALLOCATION_BASIS = exports.DEFAULT_STRIPE_FEE_ALLOCATION_BASIS = exports.DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE = exports.DEFAULT_MARKETPLACE_COMMISSION_BASIS = exports.DEFAULT_MARKETPLACE_LISTING_STATUS = exports.STOCK_STATUSES = exports.MARKETPLACE_SELLER_DEFAULT_COMMISSION = exports.MARKETPLACE_INVENTORY_POLICY_KINDS = exports.MARKETPLACE_LEDGER_STATUSES = void 0;
|
|
5
5
|
const ProductFromShopifyJSClientJSONDoc_1 = require("./factories/Product/ProductFromShopifyJSClientJSONDoc");
|
|
6
6
|
exports.ProductFromShopifyJSClientJSONDoc = ProductFromShopifyJSClientJSONDoc_1.default;
|
|
7
7
|
const ProductFromAlgoliaJSONDoc_1 = require("./factories/Product/ProductFromAlgoliaJSONDoc");
|
|
@@ -130,6 +130,8 @@ const ProductVariantHelpers_1 = require("./helpers/ProductVariantHelpers");
|
|
|
130
130
|
exports.ProductVariantHelpers = ProductVariantHelpers_1.default;
|
|
131
131
|
const ReturnPolicyHelpers_1 = require("./helpers/ReturnPolicyHelpers");
|
|
132
132
|
exports.ReturnPolicyHelpers = ReturnPolicyHelpers_1.default;
|
|
133
|
+
const ReceiptXmlHelpers_1 = require("./helpers/ReceiptXmlHelpers");
|
|
134
|
+
exports.ReceiptXmlHelpers = ReceiptXmlHelpers_1.default;
|
|
133
135
|
const ProductInventoryHelpers_1 = require("./helpers/ProductInventoryHelpers");
|
|
134
136
|
exports.ProductInventoryHelpers = ProductInventoryHelpers_1.default;
|
|
135
137
|
Object.defineProperty(exports, "PLACEHOLDER_VARIANT_ID", { enumerable: true, get: function () { return ProductInventoryHelpers_1.PLACEHOLDER_VARIANT_ID; } });
|
package/lib/translations.d.ts
CHANGED
package/lib/translations.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.originalReceiptTranslations = exports.refundPurchaseTranslations = exports.refundReceiptTranslations = exports.referenceTranslations = exports.contactlessTranslations = exports.authorizationCodeTranslations = exports.mobilePaymentTranslations = exports.cardPaymentTranslations = exports.cashTranslations = exports.purchaseTranslations = exports.taxTranslations = exports.totalTranslations = exports.receiptTranslations = void 0;
|
|
3
|
+
exports.originalReceiptTranslations = exports.refundPurchaseTranslations = exports.refundReceiptTranslations = exports.referenceTranslations = exports.contactlessTranslations = exports.authorizationCodeTranslations = exports.mobilePaymentTranslations = exports.cardPaymentTranslations = exports.cashTranslations = exports.purchaseTranslations = exports.taxTranslations = exports.totalTranslations = exports.returnPolicyReceiptTranslations = exports.receiptTranslations = void 0;
|
|
4
4
|
exports.receiptTranslations = {
|
|
5
5
|
'sv-SE': 'Kvitto',
|
|
6
6
|
'nb-NO': 'Kvittering',
|
|
@@ -8,6 +8,16 @@ exports.receiptTranslations = {
|
|
|
8
8
|
'en-UK': 'Receipt',
|
|
9
9
|
'en-DE': 'Quittung',
|
|
10
10
|
};
|
|
11
|
+
// Return-policy line on the receipt. `{days}` is replaced with the channel's
|
|
12
|
+
// returnPeriodDays. Localized per presentment locale (en-DE renders German,
|
|
13
|
+
// matching the other dicts).
|
|
14
|
+
exports.returnPolicyReceiptTranslations = {
|
|
15
|
+
'sv-SE': '{days} dagars öppet köp',
|
|
16
|
+
'nb-NO': '{days} dagers åpent kjøp',
|
|
17
|
+
'en-US': '{days} day return policy',
|
|
18
|
+
'en-UK': '{days} day return policy',
|
|
19
|
+
'en-DE': '{days} Tage Rückgaberecht',
|
|
20
|
+
};
|
|
11
21
|
exports.totalTranslations = {
|
|
12
22
|
'sv-SE': 'Totalt',
|
|
13
23
|
'nb-NO': 'Total',
|