@takeshape/util 10.4.9 → 10.4.14
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/billing.d.ts +250 -33
- package/dist/billing.d.ts.map +1 -1
- package/dist/delay.d.ts +2 -2
- package/dist/delay.d.ts.map +1 -1
- package/dist/delay.js +0 -1
- package/dist/draftjs-templates.d.ts +11 -11
- package/dist/draftjs-templates.d.ts.map +1 -1
- package/dist/draftjs-templates.js +0 -1
- package/dist/draftjs.d.ts +12 -11
- package/dist/draftjs.d.ts.map +1 -1
- package/dist/draftjs.js +17 -21
- package/dist/get-image-url.d.ts +1 -1
- package/dist/get-image-url.d.ts.map +1 -1
- package/dist/gzip.js +1 -1
- package/dist/templates.d.ts +6 -6
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +1 -1
- package/dist/tracing.d.ts +8 -8
- package/dist/tracing.d.ts.map +1 -1
- package/es/delay.js +0 -1
- package/es/draftjs-templates.js +0 -1
- package/es/draftjs.js +15 -19
- package/es/gzip.js +1 -1
- package/es/templates.js +1 -1
- package/package.json +3 -3
package/dist/billing.d.ts
CHANGED
|
@@ -1,5 +1,222 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="stripe/types/crypto/crypto" />
|
|
2
|
+
/// <reference types="stripe/types/shared" />
|
|
3
|
+
/// <reference types="stripe/types/Errors" />
|
|
4
|
+
/// <reference types="stripe/types/OAuth" />
|
|
5
|
+
/// <reference types="stripe/types/Webhooks" />
|
|
6
|
+
/// <reference types="stripe/types/UpcomingInvoices" />
|
|
7
|
+
/// <reference types="stripe/types/AccountLinksResource" />
|
|
8
|
+
/// <reference types="stripe/types/AccountSessionsResource" />
|
|
9
|
+
/// <reference types="stripe/types/AccountsResource" />
|
|
10
|
+
/// <reference types="stripe/types/ApplePayDomainsResource" />
|
|
11
|
+
/// <reference types="stripe/types/ApplicationFeesResource" />
|
|
12
|
+
/// <reference types="stripe/types/Apps/SecretsResource" />
|
|
13
|
+
/// <reference types="stripe/types/BalanceResource" />
|
|
14
|
+
/// <reference types="stripe/types/BalanceTransactionsResource" />
|
|
15
|
+
/// <reference types="stripe/types/BillingPortal/ConfigurationsResource" />
|
|
16
|
+
/// <reference types="stripe/types/BillingPortal/SessionsResource" />
|
|
17
|
+
/// <reference types="stripe/types/ChargesResource" />
|
|
18
|
+
/// <reference types="stripe/types/Checkout/SessionsResource" />
|
|
19
|
+
/// <reference types="stripe/types/CountrySpecsResource" />
|
|
20
|
+
/// <reference types="stripe/types/CouponsResource" />
|
|
21
|
+
/// <reference types="stripe/types/CreditNotesResource" />
|
|
22
|
+
/// <reference types="stripe/types/CustomersResource" />
|
|
23
|
+
/// <reference types="stripe/types/DisputesResource" />
|
|
24
|
+
/// <reference types="stripe/types/EphemeralKeysResource" />
|
|
25
|
+
/// <reference types="stripe/types/EventsResource" />
|
|
26
|
+
/// <reference types="stripe/types/ExchangeRatesResource" />
|
|
27
|
+
/// <reference types="stripe/types/FileLinksResource" />
|
|
28
|
+
/// <reference types="stripe/types/FilesResource" />
|
|
29
|
+
/// <reference types="stripe/types/FinancialConnections/AccountsResource" />
|
|
30
|
+
/// <reference types="stripe/types/FinancialConnections/SessionsResource" />
|
|
31
|
+
/// <reference types="stripe/types/Identity/VerificationReportsResource" />
|
|
32
|
+
/// <reference types="stripe/types/Identity/VerificationSessionsResource" />
|
|
33
|
+
/// <reference types="stripe/types/InvoiceItemsResource" />
|
|
34
|
+
/// <reference types="stripe/types/InvoicesResource" />
|
|
35
|
+
/// <reference types="stripe/types/Issuing/AuthorizationsResource" />
|
|
36
|
+
/// <reference types="stripe/types/Issuing/CardholdersResource" />
|
|
37
|
+
/// <reference types="stripe/types/Issuing/CardsResource" />
|
|
38
|
+
/// <reference types="stripe/types/Issuing/DisputesResource" />
|
|
39
|
+
/// <reference types="stripe/types/Issuing/TransactionsResource" />
|
|
40
|
+
/// <reference types="stripe/types/MandatesResource" />
|
|
41
|
+
/// <reference types="stripe/types/PaymentIntentsResource" />
|
|
42
|
+
/// <reference types="stripe/types/PaymentLinksResource" />
|
|
43
|
+
/// <reference types="stripe/types/PaymentMethodConfigurationsResource" />
|
|
44
|
+
/// <reference types="stripe/types/PaymentMethodDomainsResource" />
|
|
45
|
+
/// <reference types="stripe/types/PaymentMethodsResource" />
|
|
46
|
+
/// <reference types="stripe/types/PayoutsResource" />
|
|
47
|
+
/// <reference types="stripe/types/PlansResource" />
|
|
48
|
+
/// <reference types="stripe/types/PricesResource" />
|
|
49
|
+
/// <reference types="stripe/types/ProductsResource" />
|
|
50
|
+
/// <reference types="stripe/types/PromotionCodesResource" />
|
|
51
|
+
/// <reference types="stripe/types/QuotesResource" />
|
|
52
|
+
/// <reference types="stripe/types/Radar/EarlyFraudWarningsResource" />
|
|
53
|
+
/// <reference types="stripe/types/Radar/ValueListItemsResource" />
|
|
54
|
+
/// <reference types="stripe/types/Radar/ValueListsResource" />
|
|
55
|
+
/// <reference types="stripe/types/RefundsResource" />
|
|
56
|
+
/// <reference types="stripe/types/Reporting/ReportRunsResource" />
|
|
57
|
+
/// <reference types="stripe/types/Reporting/ReportTypesResource" />
|
|
58
|
+
/// <reference types="stripe/types/ReviewsResource" />
|
|
59
|
+
/// <reference types="stripe/types/SetupAttemptsResource" />
|
|
60
|
+
/// <reference types="stripe/types/SetupIntentsResource" />
|
|
61
|
+
/// <reference types="stripe/types/ShippingRatesResource" />
|
|
62
|
+
/// <reference types="stripe/types/Sigma/ScheduledQueryRunsResource" />
|
|
63
|
+
/// <reference types="stripe/types/SourcesResource" />
|
|
64
|
+
/// <reference types="stripe/types/SubscriptionItemsResource" />
|
|
65
|
+
/// <reference types="stripe/types/SubscriptionSchedulesResource" />
|
|
66
|
+
/// <reference types="stripe/types/SubscriptionsResource" />
|
|
67
|
+
/// <reference types="stripe/types/Tax/CalculationsResource" />
|
|
68
|
+
/// <reference types="stripe/types/Tax/SettingsResource" />
|
|
69
|
+
/// <reference types="stripe/types/Tax/TransactionsResource" />
|
|
70
|
+
/// <reference types="stripe/types/TaxCodesResource" />
|
|
71
|
+
/// <reference types="stripe/types/TaxRatesResource" />
|
|
72
|
+
/// <reference types="stripe/types/Terminal/ConfigurationsResource" />
|
|
73
|
+
/// <reference types="stripe/types/Terminal/ConnectionTokensResource" />
|
|
74
|
+
/// <reference types="stripe/types/Terminal/LocationsResource" />
|
|
75
|
+
/// <reference types="stripe/types/Terminal/ReadersResource" />
|
|
76
|
+
/// <reference types="stripe/types/TestHelpers/CustomersResource" />
|
|
77
|
+
/// <reference types="stripe/types/TestHelpers/Issuing/AuthorizationsResource" />
|
|
78
|
+
/// <reference types="stripe/types/TestHelpers/Issuing/CardsResource" />
|
|
79
|
+
/// <reference types="stripe/types/TestHelpers/Issuing/TransactionsResource" />
|
|
80
|
+
/// <reference types="stripe/types/TestHelpers/RefundsResource" />
|
|
81
|
+
/// <reference types="stripe/types/TestHelpers/Terminal/ReadersResource" />
|
|
82
|
+
/// <reference types="stripe/types/TestHelpers/TestClocksResource" />
|
|
83
|
+
/// <reference types="stripe/types/TestHelpers/Treasury/InboundTransfersResource" />
|
|
84
|
+
/// <reference types="stripe/types/TestHelpers/Treasury/OutboundPaymentsResource" />
|
|
85
|
+
/// <reference types="stripe/types/TestHelpers/Treasury/OutboundTransfersResource" />
|
|
86
|
+
/// <reference types="stripe/types/TestHelpers/Treasury/ReceivedCreditsResource" />
|
|
87
|
+
/// <reference types="stripe/types/TestHelpers/Treasury/ReceivedDebitsResource" />
|
|
88
|
+
/// <reference types="stripe/types/TokensResource" />
|
|
89
|
+
/// <reference types="stripe/types/TopupsResource" />
|
|
90
|
+
/// <reference types="stripe/types/TransfersResource" />
|
|
91
|
+
/// <reference types="stripe/types/Treasury/CreditReversalsResource" />
|
|
92
|
+
/// <reference types="stripe/types/Treasury/DebitReversalsResource" />
|
|
93
|
+
/// <reference types="stripe/types/Treasury/FinancialAccountsResource" />
|
|
94
|
+
/// <reference types="stripe/types/Treasury/InboundTransfersResource" />
|
|
95
|
+
/// <reference types="stripe/types/Treasury/OutboundPaymentsResource" />
|
|
96
|
+
/// <reference types="stripe/types/Treasury/OutboundTransfersResource" />
|
|
97
|
+
/// <reference types="stripe/types/Treasury/ReceivedCreditsResource" />
|
|
98
|
+
/// <reference types="stripe/types/Treasury/ReceivedDebitsResource" />
|
|
99
|
+
/// <reference types="stripe/types/Treasury/TransactionEntriesResource" />
|
|
100
|
+
/// <reference types="stripe/types/Treasury/TransactionsResource" />
|
|
101
|
+
/// <reference types="stripe/types/WebhookEndpointsResource" />
|
|
102
|
+
/// <reference types="stripe/types/AccountLinks" />
|
|
103
|
+
/// <reference types="stripe/types/AccountSessions" />
|
|
104
|
+
/// <reference types="stripe/types/Accounts" />
|
|
105
|
+
/// <reference types="stripe/types/ApplePayDomains" />
|
|
106
|
+
/// <reference types="stripe/types/ApplicationFees" />
|
|
107
|
+
/// <reference types="stripe/types/Applications" />
|
|
108
|
+
/// <reference types="stripe/types/Apps/Secrets" />
|
|
109
|
+
/// <reference types="stripe/types/Balance" />
|
|
110
|
+
/// <reference types="stripe/types/BalanceTransactions" />
|
|
111
|
+
/// <reference types="stripe/types/BankAccounts" />
|
|
112
|
+
/// <reference types="stripe/types/BillingPortal/Configurations" />
|
|
113
|
+
/// <reference types="stripe/types/BillingPortal/Sessions" />
|
|
114
|
+
/// <reference types="stripe/types/Capabilities" />
|
|
115
|
+
/// <reference types="stripe/types/Cards" />
|
|
116
|
+
/// <reference types="stripe/types/CashBalances" />
|
|
117
|
+
/// <reference types="stripe/types/Charges" />
|
|
118
|
+
/// <reference types="stripe/types/Checkout/Sessions" />
|
|
119
|
+
/// <reference types="stripe/types/ConnectCollectionTransfers" />
|
|
120
|
+
/// <reference types="stripe/types/CountrySpecs" />
|
|
121
|
+
/// <reference types="stripe/types/Coupons" />
|
|
122
|
+
/// <reference types="stripe/types/CreditNoteLineItems" />
|
|
123
|
+
/// <reference types="stripe/types/CreditNotes" />
|
|
124
|
+
/// <reference types="stripe/types/CustomerBalanceTransactions" />
|
|
125
|
+
/// <reference types="stripe/types/CustomerCashBalanceTransactions" />
|
|
126
|
+
/// <reference types="stripe/types/Customers" />
|
|
127
|
+
/// <reference types="stripe/types/Discounts" />
|
|
128
|
+
/// <reference types="stripe/types/Disputes" />
|
|
129
|
+
/// <reference types="stripe/types/EphemeralKeys" />
|
|
130
|
+
/// <reference types="stripe/types/Events" />
|
|
131
|
+
/// <reference types="stripe/types/ExchangeRates" />
|
|
132
|
+
/// <reference types="stripe/types/FeeRefunds" />
|
|
133
|
+
/// <reference types="stripe/types/FileLinks" />
|
|
134
|
+
/// <reference types="stripe/types/Files" />
|
|
135
|
+
/// <reference types="stripe/types/FinancialConnections/AccountOwners" />
|
|
136
|
+
/// <reference types="stripe/types/FinancialConnections/AccountOwnerships" />
|
|
137
|
+
/// <reference types="stripe/types/FinancialConnections/Accounts" />
|
|
138
|
+
/// <reference types="stripe/types/FinancialConnections/Sessions" />
|
|
139
|
+
/// <reference types="stripe/types/FundingInstructions" />
|
|
140
|
+
/// <reference types="stripe/types/Identity/VerificationReports" />
|
|
141
|
+
/// <reference types="stripe/types/Identity/VerificationSessions" />
|
|
142
|
+
/// <reference types="stripe/types/InvoiceItems" />
|
|
143
|
+
/// <reference types="stripe/types/InvoiceLineItems" />
|
|
144
|
+
/// <reference types="stripe/types/Invoices" />
|
|
145
|
+
/// <reference types="stripe/types/Issuing/Authorizations" />
|
|
146
|
+
/// <reference types="stripe/types/Issuing/Cardholders" />
|
|
147
|
+
/// <reference types="stripe/types/Issuing/Cards" />
|
|
148
|
+
/// <reference types="stripe/types/Issuing/Disputes" />
|
|
149
|
+
/// <reference types="stripe/types/Issuing/Transactions" />
|
|
150
|
+
/// <reference types="stripe/types/LineItems" />
|
|
151
|
+
/// <reference types="stripe/types/LoginLinks" />
|
|
152
|
+
/// <reference types="stripe/types/Mandates" />
|
|
153
|
+
/// <reference types="stripe/types/PaymentIntents" />
|
|
154
|
+
/// <reference types="stripe/types/PaymentLinks" />
|
|
155
|
+
/// <reference types="stripe/types/PaymentMethodConfigurations" />
|
|
156
|
+
/// <reference types="stripe/types/PaymentMethodDomains" />
|
|
157
|
+
/// <reference types="stripe/types/PaymentMethods" />
|
|
158
|
+
/// <reference types="stripe/types/Payouts" />
|
|
159
|
+
/// <reference types="stripe/types/Persons" />
|
|
160
|
+
/// <reference types="stripe/types/Plans" />
|
|
161
|
+
/// <reference types="stripe/types/PlatformTaxFees" />
|
|
162
|
+
/// <reference types="stripe/types/Prices" />
|
|
163
|
+
/// <reference types="stripe/types/Products" />
|
|
164
|
+
/// <reference types="stripe/types/PromotionCodes" />
|
|
165
|
+
/// <reference types="stripe/types/Quotes" />
|
|
166
|
+
/// <reference types="stripe/types/Radar/EarlyFraudWarnings" />
|
|
167
|
+
/// <reference types="stripe/types/Radar/ValueListItems" />
|
|
168
|
+
/// <reference types="stripe/types/Radar/ValueLists" />
|
|
169
|
+
/// <reference types="stripe/types/Refunds" />
|
|
170
|
+
/// <reference types="stripe/types/Reporting/ReportRuns" />
|
|
171
|
+
/// <reference types="stripe/types/Reporting/ReportTypes" />
|
|
172
|
+
/// <reference types="stripe/types/ReserveTransactions" />
|
|
173
|
+
/// <reference types="stripe/types/Reviews" />
|
|
174
|
+
/// <reference types="stripe/types/SetupAttempts" />
|
|
175
|
+
/// <reference types="stripe/types/SetupIntents" />
|
|
176
|
+
/// <reference types="stripe/types/ShippingRates" />
|
|
177
|
+
/// <reference types="stripe/types/Sigma/ScheduledQueryRuns" />
|
|
178
|
+
/// <reference types="stripe/types/SourceMandateNotifications" />
|
|
179
|
+
/// <reference types="stripe/types/SourceTransactions" />
|
|
180
|
+
/// <reference types="stripe/types/Sources" />
|
|
181
|
+
/// <reference types="stripe/types/SubscriptionItems" />
|
|
182
|
+
/// <reference types="stripe/types/SubscriptionSchedules" />
|
|
183
|
+
/// <reference types="stripe/types/Subscriptions" />
|
|
184
|
+
/// <reference types="stripe/types/Tax/CalculationLineItems" />
|
|
185
|
+
/// <reference types="stripe/types/Tax/Calculations" />
|
|
186
|
+
/// <reference types="stripe/types/Tax/Settings" />
|
|
187
|
+
/// <reference types="stripe/types/Tax/TransactionLineItems" />
|
|
188
|
+
/// <reference types="stripe/types/Tax/Transactions" />
|
|
189
|
+
/// <reference types="stripe/types/TaxCodes" />
|
|
190
|
+
/// <reference types="stripe/types/TaxDeductedAtSources" />
|
|
191
|
+
/// <reference types="stripe/types/TaxIds" />
|
|
192
|
+
/// <reference types="stripe/types/TaxRates" />
|
|
193
|
+
/// <reference types="stripe/types/Terminal/Configurations" />
|
|
194
|
+
/// <reference types="stripe/types/Terminal/ConnectionTokens" />
|
|
195
|
+
/// <reference types="stripe/types/Terminal/Locations" />
|
|
196
|
+
/// <reference types="stripe/types/Terminal/Readers" />
|
|
197
|
+
/// <reference types="stripe/types/TestHelpers/TestClocks" />
|
|
198
|
+
/// <reference types="stripe/types/Tokens" />
|
|
199
|
+
/// <reference types="stripe/types/Topups" />
|
|
200
|
+
/// <reference types="stripe/types/TransferReversals" />
|
|
201
|
+
/// <reference types="stripe/types/Transfers" />
|
|
202
|
+
/// <reference types="stripe/types/Treasury/CreditReversals" />
|
|
203
|
+
/// <reference types="stripe/types/Treasury/DebitReversals" />
|
|
204
|
+
/// <reference types="stripe/types/Treasury/FinancialAccountFeatures" />
|
|
205
|
+
/// <reference types="stripe/types/Treasury/FinancialAccounts" />
|
|
206
|
+
/// <reference types="stripe/types/Treasury/InboundTransfers" />
|
|
207
|
+
/// <reference types="stripe/types/Treasury/OutboundPayments" />
|
|
208
|
+
/// <reference types="stripe/types/Treasury/OutboundTransfers" />
|
|
209
|
+
/// <reference types="stripe/types/Treasury/ReceivedCredits" />
|
|
210
|
+
/// <reference types="stripe/types/Treasury/ReceivedDebits" />
|
|
211
|
+
/// <reference types="stripe/types/Treasury/TransactionEntries" />
|
|
212
|
+
/// <reference types="stripe/types/Treasury/Transactions" />
|
|
213
|
+
/// <reference types="stripe/types/UsageRecordSummaries" />
|
|
214
|
+
/// <reference types="stripe/types/UsageRecords" />
|
|
215
|
+
/// <reference types="stripe/types/WebhookEndpoints" />
|
|
216
|
+
/// <reference types="stripe/types/lib" />
|
|
217
|
+
/// <reference types="stripe/types/net/net" />
|
|
218
|
+
import type Stripe from 'stripe';
|
|
219
|
+
export type Customer = {
|
|
3
220
|
id: string;
|
|
4
221
|
email?: string;
|
|
5
222
|
default_source?: string;
|
|
@@ -7,33 +224,33 @@ export interface Customer {
|
|
|
7
224
|
usedTrial?: 'true' | 'false';
|
|
8
225
|
enterprise?: 'true' | 'false';
|
|
9
226
|
};
|
|
10
|
-
}
|
|
11
|
-
export
|
|
227
|
+
};
|
|
228
|
+
export type Subscription = {
|
|
12
229
|
id: string;
|
|
13
230
|
status: string;
|
|
14
231
|
trial_end: number;
|
|
15
|
-
}
|
|
16
|
-
export
|
|
232
|
+
};
|
|
233
|
+
export type TaxId = {
|
|
17
234
|
type: string;
|
|
18
235
|
value: string;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
236
|
+
};
|
|
237
|
+
export type BillingAddress = {
|
|
21
238
|
city?: string;
|
|
22
239
|
country?: string;
|
|
23
240
|
line1: string;
|
|
24
241
|
line2: string | null;
|
|
25
242
|
postal_code?: string;
|
|
26
243
|
state?: string;
|
|
27
|
-
}
|
|
28
|
-
export
|
|
244
|
+
};
|
|
245
|
+
export type AdressChangeEvent = {
|
|
29
246
|
name: string;
|
|
30
247
|
firstName?: string;
|
|
31
248
|
lastName?: string;
|
|
32
249
|
address: BillingAddress;
|
|
33
250
|
phone?: string;
|
|
34
|
-
}
|
|
251
|
+
};
|
|
35
252
|
export type SUPPORTED_BILLING_INTERVAL = 'month' | 'year';
|
|
36
|
-
export
|
|
253
|
+
export type UpdateParams = {
|
|
37
254
|
paymentMethodId?: string;
|
|
38
255
|
billingInterval?: SUPPORTED_BILLING_INTERVAL;
|
|
39
256
|
planId?: string;
|
|
@@ -41,8 +258,8 @@ export interface UpdateParams {
|
|
|
41
258
|
email?: string;
|
|
42
259
|
taxId?: TaxId;
|
|
43
260
|
address?: Stripe.AddressParam;
|
|
44
|
-
}
|
|
45
|
-
export
|
|
261
|
+
};
|
|
262
|
+
export type BillingInfo = {
|
|
46
263
|
enterprise?: boolean;
|
|
47
264
|
paymentMethodDetails?: PaymentMethodDetails;
|
|
48
265
|
plan?: Plan;
|
|
@@ -52,13 +269,13 @@ export interface BillingInfo {
|
|
|
52
269
|
taxId?: TaxId;
|
|
53
270
|
address?: string;
|
|
54
271
|
annualPlan?: Plan;
|
|
55
|
-
}
|
|
56
|
-
export
|
|
272
|
+
};
|
|
273
|
+
export type PaymentMethodDetails = {
|
|
57
274
|
type: 'card' | 'bank_account' | 'other';
|
|
58
275
|
summary: string;
|
|
59
|
-
}
|
|
276
|
+
};
|
|
60
277
|
export declare const DEFAULT_MIN_SCHEDULE_TRIGGER_INTERVAL = 60;
|
|
61
|
-
export
|
|
278
|
+
export type Entitlements = {
|
|
62
279
|
users: number;
|
|
63
280
|
apiRequests: number;
|
|
64
281
|
apiRateLimit: number;
|
|
@@ -72,9 +289,9 @@ export interface Entitlements {
|
|
|
72
289
|
providers: string[];
|
|
73
290
|
minScheduleTriggerInterval: number;
|
|
74
291
|
bandwidth?: number;
|
|
75
|
-
}
|
|
292
|
+
};
|
|
76
293
|
export declare const DEFAULT_ENTITLEMENTS: Entitlements;
|
|
77
|
-
export
|
|
294
|
+
export type Plan = {
|
|
78
295
|
id: string;
|
|
79
296
|
name: string;
|
|
80
297
|
amount: number;
|
|
@@ -86,35 +303,35 @@ export interface Plan {
|
|
|
86
303
|
intervalCount: number;
|
|
87
304
|
trialPeriodDays: number;
|
|
88
305
|
entitlements: Entitlements;
|
|
89
|
-
}
|
|
90
|
-
export
|
|
306
|
+
};
|
|
307
|
+
export type Discount = {
|
|
91
308
|
code: string;
|
|
92
309
|
percentOff: number | null;
|
|
93
310
|
amountOff: number | null;
|
|
94
311
|
duration: string | null;
|
|
95
|
-
}
|
|
312
|
+
};
|
|
96
313
|
/**
|
|
97
314
|
* Stripe is replacing plans with prices. The Stripe API still returns a plan property on subscriptions
|
|
98
315
|
* but it has already been removed from the types. This interface should only be used in the specific places
|
|
99
316
|
* where we use plans so they can be easily found and migrated in the future.
|
|
100
317
|
* More info https://stripe.com/docs/billing/migration/migrating-prices
|
|
101
318
|
*/
|
|
102
|
-
export
|
|
319
|
+
export type SubscriptionWithPlan = {
|
|
103
320
|
plan: {
|
|
104
321
|
id: string;
|
|
105
322
|
};
|
|
106
|
-
}
|
|
323
|
+
} & Stripe.Subscription;
|
|
107
324
|
export declare function isStripeProductObject(product: string | Stripe.Product | Stripe.DeletedProduct | null): product is Stripe.Product;
|
|
108
325
|
export declare function getStripeProductObject(product: string | Stripe.Product | Stripe.DeletedProduct | null): Stripe.Product;
|
|
109
326
|
export declare function isStripeChargeObject(charge: string | Stripe.Charge | null): charge is Stripe.Charge;
|
|
110
327
|
export type ProductsMapping = Record<string, Stripe.Product>;
|
|
111
|
-
export
|
|
328
|
+
export type PaymentAmount = {
|
|
112
329
|
total: number;
|
|
113
330
|
subtotal: number;
|
|
114
331
|
discount: Discount | null;
|
|
115
332
|
refund?: number | null;
|
|
116
|
-
}
|
|
117
|
-
export
|
|
333
|
+
};
|
|
334
|
+
export type Payment = {
|
|
118
335
|
date: string;
|
|
119
336
|
plan: string;
|
|
120
337
|
status: string;
|
|
@@ -122,8 +339,8 @@ export interface Payment {
|
|
|
122
339
|
method: string;
|
|
123
340
|
invoicePdf?: string;
|
|
124
341
|
billingInterval?: string;
|
|
125
|
-
}
|
|
126
|
-
export
|
|
342
|
+
};
|
|
343
|
+
export type BillingUsage = {
|
|
127
344
|
users: number;
|
|
128
345
|
endTime: string;
|
|
129
346
|
startTime: string;
|
|
@@ -134,8 +351,8 @@ export interface BillingUsage {
|
|
|
134
351
|
deployTargets: number;
|
|
135
352
|
roles: number;
|
|
136
353
|
apiRequests: number;
|
|
137
|
-
}
|
|
138
|
-
export
|
|
354
|
+
};
|
|
355
|
+
export type BillingUsageFromApi = {
|
|
139
356
|
bandwidth: string;
|
|
140
|
-
}
|
|
357
|
+
} & Omit<BillingUsage, 'bandwidth'>;
|
|
141
358
|
//# sourceMappingURL=billing.d.ts.map
|
package/dist/billing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/billing.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/billing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CA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Ac,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC"}
|
package/dist/delay.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const delay: <T>(timeout: number, value?: T | undefined) => Promise<T>;
|
|
2
|
-
export
|
|
2
|
+
export type Attempt = {
|
|
3
3
|
num: number;
|
|
4
4
|
lastDelay: number;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export declare function backoff(baseDelay: number, maxDelay: number, attempt?: Attempt): Promise<Attempt>;
|
|
7
7
|
//# sourceMappingURL=delay.d.ts.map
|
package/dist/delay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,eAAsB,MAAM,sCAG1C,CAAC;AAEL,MAAM,
|
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/delay.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,eAAsB,MAAM,sCAG1C,CAAC;AAEL,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AASF,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,OAAgC,GACxC,OAAO,CAAC,OAAO,CAAC,CAOlB"}
|
package/dist/delay.js
CHANGED
|
@@ -10,7 +10,6 @@ const delay = async (timeout, value) => new Promise(resolve => {
|
|
|
10
10
|
});
|
|
11
11
|
exports.delay = delay;
|
|
12
12
|
function randomInt(minimum, maximum) {
|
|
13
|
-
// eslint-disable-next-line security-node/detect-insecure-randomness
|
|
14
13
|
const co = Math.random() * (maximum - minimum + 1);
|
|
15
14
|
return Math.floor(co + minimum);
|
|
16
15
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { RawDraftContentBlock } from 'draft-js';
|
|
2
|
-
export
|
|
1
|
+
import { type RawDraftContentBlock } from 'draft-js';
|
|
2
|
+
export type DraftjsTemplateResult = {
|
|
3
3
|
contentBlock: RawDraftContentBlock;
|
|
4
4
|
entities: any;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
5
|
+
};
|
|
6
|
+
export type DraftjsLinkOpenParams = {
|
|
7
7
|
text: string;
|
|
8
8
|
href: string;
|
|
9
9
|
depth: number;
|
|
10
10
|
key: number;
|
|
11
11
|
offset: number;
|
|
12
|
-
}
|
|
13
|
-
export
|
|
12
|
+
};
|
|
13
|
+
export type DraftjsImageParams = {
|
|
14
14
|
captionText: string;
|
|
15
15
|
creditText: string;
|
|
16
16
|
alignment?: string;
|
|
@@ -21,14 +21,14 @@ export interface DraftjsImageParams {
|
|
|
21
21
|
depth: number;
|
|
22
22
|
key: number;
|
|
23
23
|
path: string;
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
export declare const getDraftjsImage: (params: DraftjsImageParams) => DraftjsTemplateResult | undefined;
|
|
26
|
-
export
|
|
26
|
+
export type DraftjsPullquoteParams = {
|
|
27
27
|
text: string;
|
|
28
28
|
depth: number;
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
export declare const getDraftjsPullquote: (params: DraftjsPullquoteParams) => DraftjsTemplateResult;
|
|
31
|
-
export
|
|
31
|
+
export type DraftjsOembedParams = {
|
|
32
32
|
html: string;
|
|
33
33
|
depth: number;
|
|
34
34
|
key: number;
|
|
@@ -42,6 +42,6 @@ export interface DraftjsOembedParams {
|
|
|
42
42
|
provider_name?: string;
|
|
43
43
|
provider_url?: string;
|
|
44
44
|
version?: string;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
export declare const getDraftjsOembed: (params: DraftjsOembedParams) => DraftjsTemplateResult;
|
|
47
47
|
//# sourceMappingURL=draftjs-templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draftjs-templates.d.ts","sourceRoot":"","sources":["../../src/draftjs-templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"draftjs-templates.d.ts","sourceRoot":"","sources":["../../src/draftjs-templates.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAGnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,oBAAoB,CAAC;IACnC,QAAQ,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,kBAAkB,KAAG,qBAAqB,GAAG,SAmEpF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,sBAAsB,KAAG,qBAcpE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,mBAAmB,KAAG,qBAsD9D,CAAC"}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getDraftjsPullquote = exports.getDraftjsOembed = exports.getDraftjsImage = void 0;
|
|
7
7
|
var _shortid = _interopRequireDefault(require("shortid"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
/* eslint-disable camelcase */
|
|
10
9
|
/*
|
|
11
10
|
* The intention is to move all this to the client package in the end, but right now it's here
|
|
12
11
|
* to be shared between the draftjs / mdx implementations, which span the client / server differently.
|
package/dist/draftjs.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { RawDraftContentState, Entity
|
|
2
|
-
export
|
|
1
|
+
import { type RawDraftContentState, type Entity } from 'draft-js';
|
|
2
|
+
export type Content = {
|
|
3
3
|
[name: string]: any;
|
|
4
4
|
_id: string;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export type MaybeContent = Content | undefined;
|
|
7
|
-
|
|
7
|
+
type DraftEntityWithData = {
|
|
8
8
|
type?: string;
|
|
9
9
|
mutability?: string;
|
|
10
10
|
data?: Record<string, any>;
|
|
11
|
-
}
|
|
11
|
+
} & Entity;
|
|
12
12
|
type DraftToMarkdownOptionsItems = Record<string, {
|
|
13
13
|
open: (entity?: DraftEntityWithData) => string;
|
|
14
14
|
close: (entity?: DraftEntityWithData) => string;
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
|
-
* Adjust entity ranges to insert `amount` space starting at `after`.
|
|
17
|
+
* Adjust entity ranges or inline style ranges to insert `amount` space starting at `after`.
|
|
18
18
|
* For example, take this visualization of a range with offset 5 and length 5, where
|
|
19
19
|
* the vertical bars are the start and end of the range, inclusive:
|
|
20
20
|
* -----|---|-----
|
|
@@ -27,15 +27,16 @@ type DraftToMarkdownOptionsItems = Record<string, {
|
|
|
27
27
|
* If you insert amount -2 after 7 you get this:
|
|
28
28
|
* -----|-|-----
|
|
29
29
|
*/
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const adjustRanges: <T extends {
|
|
31
31
|
offset: number;
|
|
32
32
|
length: number;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
}>(ranges: T[], after: number, amount: number) => (T & {
|
|
34
|
+
offset: number;
|
|
35
|
+
length: number;
|
|
36
|
+
})[];
|
|
35
37
|
/**
|
|
36
38
|
* Encode HTML entities in this draftjs state.
|
|
37
|
-
* We adjust
|
|
38
|
-
* encoded text.
|
|
39
|
+
* We adjust ranges so that their offsets and lengths are still correct with the encoded text.
|
|
39
40
|
* EG `'` is 5 characters longer than `'` so if there is a single apostrophe before a link,
|
|
40
41
|
* the link entity's offset needs to be increased by 5 when the text is encoded.
|
|
41
42
|
* This also applies to the entity's length if there are escaped characters inside the entity.
|
package/dist/draftjs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draftjs.d.ts","sourceRoot":"","sources":["../../src/draftjs.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YAAY,CAC1B,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACpC,MAAM,8BAAqB,GAC1B,MAAM,CAyDR;AA4MD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAgD7D;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AA8ND;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAkB5D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CA0G9D"}
|
package/dist/draftjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.adjustRanges = void 0;
|
|
7
7
|
exports.draftjsToMd = draftjsToMd;
|
|
8
8
|
exports.draftjsToMdx = draftjsToMdx;
|
|
9
9
|
exports.encodeHtmlEntities = void 0;
|
|
@@ -13,18 +13,18 @@ exports.insertBreaksAroundBlocks = insertBreaksAroundBlocks;
|
|
|
13
13
|
exports.mdToDraftjs = mdToDraftjs;
|
|
14
14
|
exports.mdxToDraftjs = mdxToDraftjs;
|
|
15
15
|
var _markdownDraftJs = require("markdown-draft-js");
|
|
16
|
-
var _templates = require("./templates");
|
|
17
16
|
var _htmlparser = require("htmlparser2");
|
|
18
17
|
var _urlParse = _interopRequireDefault(require("url-parse"));
|
|
19
18
|
var _domSerializer = _interopRequireDefault(require("dom-serializer"));
|
|
20
19
|
var _shortid = _interopRequireDefault(require("shortid"));
|
|
21
|
-
var _draftjsTemplates = require("./draftjs-templates");
|
|
22
20
|
var _escape = _interopRequireDefault(require("lodash/escape"));
|
|
23
21
|
var _unescape = _interopRequireDefault(require("lodash/unescape"));
|
|
24
22
|
var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
|
|
25
23
|
var _routing = require("@takeshape/routing");
|
|
26
24
|
var _forEach = _interopRequireDefault(require("lodash/forEach"));
|
|
27
25
|
var _he = _interopRequireDefault(require("he"));
|
|
26
|
+
var _draftjsTemplates = require("./draftjs-templates");
|
|
27
|
+
var _templates = require("./templates");
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
/*
|
|
30
30
|
* The intention is to move all this to the client package in the end, but right now it's here
|
|
@@ -86,7 +86,7 @@ const handleExternalLinks = markdown => {
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* Adjust entity ranges to insert `amount` space starting at `after`.
|
|
89
|
+
* Adjust entity ranges or inline style ranges to insert `amount` space starting at `after`.
|
|
90
90
|
* For example, take this visualization of a range with offset 5 and length 5, where
|
|
91
91
|
* the vertical bars are the start and end of the range, inclusive:
|
|
92
92
|
* -----|---|-----
|
|
@@ -99,23 +99,22 @@ const handleExternalLinks = markdown => {
|
|
|
99
99
|
* If you insert amount -2 after 7 you get this:
|
|
100
100
|
* -----|-|-----
|
|
101
101
|
*/
|
|
102
|
-
const
|
|
103
|
-
return
|
|
104
|
-
...
|
|
105
|
-
offset:
|
|
106
|
-
length:
|
|
102
|
+
const adjustRanges = (ranges, after, amount) => {
|
|
103
|
+
return ranges.map(range => ({
|
|
104
|
+
...range,
|
|
105
|
+
offset: range.offset > after ? range.offset + amount : range.offset,
|
|
106
|
+
length: range.offset <= after && range.offset + range.length > after ? range.length + amount : range.length
|
|
107
107
|
}));
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Encode HTML entities in this draftjs state.
|
|
112
|
-
* We adjust
|
|
113
|
-
* encoded text.
|
|
112
|
+
* We adjust ranges so that their offsets and lengths are still correct with the encoded text.
|
|
114
113
|
* EG `'` is 5 characters longer than `'` so if there is a single apostrophe before a link,
|
|
115
114
|
* the link entity's offset needs to be increased by 5 when the text is encoded.
|
|
116
115
|
* This also applies to the entity's length if there are escaped characters inside the entity.
|
|
117
116
|
*/
|
|
118
|
-
exports.
|
|
117
|
+
exports.adjustRanges = adjustRanges;
|
|
119
118
|
const encodeHtmlEntities = draftjs => {
|
|
120
119
|
const result = {
|
|
121
120
|
...draftjs,
|
|
@@ -124,14 +123,16 @@ const encodeHtmlEntities = draftjs => {
|
|
|
124
123
|
text
|
|
125
124
|
} = block;
|
|
126
125
|
let {
|
|
127
|
-
entityRanges
|
|
126
|
+
entityRanges,
|
|
127
|
+
inlineStyleRanges
|
|
128
128
|
} = block;
|
|
129
129
|
for (let i = 0; i < text.length; i++) {
|
|
130
130
|
const char = text.charAt(i);
|
|
131
131
|
const encodedChar = _he.default.encode(char);
|
|
132
132
|
if (encodedChar !== char) {
|
|
133
133
|
const offset = encodedChar.length - char.length;
|
|
134
|
-
entityRanges =
|
|
134
|
+
entityRanges = adjustRanges(entityRanges, i, offset);
|
|
135
|
+
inlineStyleRanges = adjustRanges(inlineStyleRanges, i, offset);
|
|
135
136
|
text = text.substring(0, i) + encodedChar + text.substring(i + 1);
|
|
136
137
|
i += offset;
|
|
137
138
|
}
|
|
@@ -139,6 +140,7 @@ const encodeHtmlEntities = draftjs => {
|
|
|
139
140
|
return {
|
|
140
141
|
...block,
|
|
141
142
|
entityRanges,
|
|
143
|
+
inlineStyleRanges,
|
|
142
144
|
text
|
|
143
145
|
};
|
|
144
146
|
})
|
|
@@ -214,7 +216,6 @@ function fromDraftjs(draftjs, styleItems, entityItems) {
|
|
|
214
216
|
markdown = handleExternalLinks(markdown);
|
|
215
217
|
markdown = handleMultiword(markdown, SUPERSCRIPT_MARKER, '^', /\^/g);
|
|
216
218
|
markdown = handleMultiword(markdown, SUBSCRIPT_MARKER, '~', /~/g);
|
|
217
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
218
219
|
markdown = markdown.replace(/\+/g, '\\+').replace(new RegExp(INSERT_MARKER, 'g'), '++');
|
|
219
220
|
return markdown;
|
|
220
221
|
}
|
|
@@ -704,7 +705,6 @@ const blockEnds = [{
|
|
|
704
705
|
}];
|
|
705
706
|
const getLookBehindValue = (end, str) => {
|
|
706
707
|
if (end.lookBehind) {
|
|
707
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
708
708
|
const behindMatch = new RegExp(end.lookBehind).exec(str);
|
|
709
709
|
if (behindMatch) {
|
|
710
710
|
return behindMatch[0];
|
|
@@ -718,18 +718,14 @@ const getLookBehindValue = (end, str) => {
|
|
|
718
718
|
*/
|
|
719
719
|
function insertBreaksAroundBlocks(mdx) {
|
|
720
720
|
for (const start of blockStarts) {
|
|
721
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
722
721
|
mdx = mdx.replace(new RegExp(`^${start.regex}`, 'g'), `<br/>\n\n${start.replacement}`);
|
|
723
722
|
}
|
|
724
723
|
for (const end of blockEnds) {
|
|
725
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
726
724
|
mdx = mdx.replace(new RegExp(`${end.lookBehind ?? ''}${end.regex}\\s*$`, 'g'), match => {
|
|
727
725
|
return `${getLookBehindValue(end, match)}${end.replacement}\n\n<br/>`;
|
|
728
726
|
});
|
|
729
727
|
for (const start of blockStarts) {
|
|
730
|
-
mdx = mdx.replace(
|
|
731
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
732
|
-
new RegExp(`${end.lookBehind ?? ''}${end.regex}\\s*${start.regex}`, 'g'), match => {
|
|
728
|
+
mdx = mdx.replace(new RegExp(`${end.lookBehind ?? ''}${end.regex}\\s*${start.regex}`, 'g'), match => {
|
|
733
729
|
return `${getLookBehindValue(end, match)}${end.replacement ?? 'FFF'}\n\n<br/>\n\n${start.replacement}`;
|
|
734
730
|
});
|
|
735
731
|
}
|
package/dist/get-image-url.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetPath, ImgixParams } from '@takeshape/routing';
|
|
1
|
+
import { type AssetPath, type ImgixParams } from '@takeshape/routing';
|
|
2
2
|
export declare function getImageUrl(path: AssetPath, defaultImageConfig: {
|
|
3
3
|
auto: string;
|
|
4
4
|
}, imageBaseUrl: string, config?: ImgixParams): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-image-url.d.ts","sourceRoot":"","sources":["../../src/get-image-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAA2B,WAAW,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-image-url.d.ts","sourceRoot":"","sources":["../../src/get-image-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,SAAS,EAA2B,KAAK,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE7F,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,EACf,kBAAkB,EAAE;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,EACD,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,MAAM,CAER"}
|
package/dist/gzip.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.gzip = exports.gunzip = void 0;
|
|
7
|
-
var _pify = _interopRequireDefault(require("pify"));
|
|
8
7
|
var _zlib = _interopRequireDefault(require("zlib"));
|
|
8
|
+
var _pify = _interopRequireDefault(require("pify"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
const gzip = exports.gzip = (0, _pify.default)(_zlib.default.gzip);
|
|
11
11
|
const gunzip = exports.gunzip = (0, _pify.default)(_zlib.default.gunzip);
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ImgixParams } from '@takeshape/routing';
|
|
2
|
-
import { MaybeContent } from './draftjs';
|
|
1
|
+
import { type ImgixParams } from '@takeshape/routing';
|
|
2
|
+
import { type MaybeContent } from './draftjs';
|
|
3
3
|
export declare function getApplyPrefix(prefix: string): (str: string) => string;
|
|
4
|
-
|
|
4
|
+
type AttrsObj = {
|
|
5
5
|
alt: string;
|
|
6
6
|
title: string;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare function attrs(obj: AttrsObj): string;
|
|
9
|
-
export
|
|
9
|
+
export type ImageTemplateData = {
|
|
10
10
|
caption: string;
|
|
11
11
|
credit: string;
|
|
12
12
|
alignment: string;
|
|
@@ -17,7 +17,7 @@ export interface ImageTemplateData {
|
|
|
17
17
|
url: string;
|
|
18
18
|
external: boolean;
|
|
19
19
|
};
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
export declare function imageTemplate(applyPrefix: (str: string) => string, data: ImageTemplateData): string;
|
|
22
22
|
export declare function imageTemplateMdx(applyPrefix: (str: string) => string, data: Record<string, string>): string;
|
|
23
23
|
export declare function oembedTemplate(applyPrefix: (str: string) => string, data: Record<string, string>): string;
|
package/dist/templates.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/templates.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,WAAW,EAAc,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,WAAW,CAAC;AAE5C,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAEtE;AAED,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,KAAK,CAAC,GAAG,EAAE,QAAQ,UAalC;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,CAAC,EAAE;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH,CAAC;AAEF,wBAAgB,aAAa,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,IAAI,EAAE,iBAAiB,UA6B1F;AAaD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAMlG;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAEhG;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAOnG;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,IAAI,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,UAMrG"}
|
package/dist/templates.js
CHANGED
|
@@ -11,9 +11,9 @@ exports.imageTemplateMdx = imageTemplateMdx;
|
|
|
11
11
|
exports.oembedTemplate = oembedTemplate;
|
|
12
12
|
exports.oembedTemplateMdx = oembedTemplateMdx;
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _highlightCode = require("./highlight-code");
|
|
15
14
|
var _escape = _interopRequireDefault(require("lodash/escape"));
|
|
16
15
|
var _routing = require("@takeshape/routing");
|
|
16
|
+
var _highlightCode = require("./highlight-code");
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
/*
|
|
19
19
|
* The intention is to move all this to the client package in the end, but right now it's here
|
package/dist/tracing.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export type ResolverArgs = Record<string, any>;
|
|
2
|
-
export
|
|
2
|
+
export type TraceRequest = {
|
|
3
3
|
body: unknown;
|
|
4
4
|
headers?: Record<string, string | string[] | undefined>;
|
|
5
5
|
method?: string;
|
|
6
6
|
searchParams?: Record<string, string>;
|
|
7
7
|
url?: string;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
};
|
|
9
|
+
export type TraceResponse = {
|
|
10
10
|
cacheHit?: boolean;
|
|
11
11
|
data: unknown;
|
|
12
12
|
headers?: Record<string, string | string[] | undefined>;
|
|
13
13
|
statusCode: number;
|
|
14
14
|
statusMessage?: string;
|
|
15
|
-
}
|
|
16
|
-
export
|
|
15
|
+
};
|
|
16
|
+
export type TraceDetails = {
|
|
17
17
|
id?: string;
|
|
18
18
|
args?: ResolverArgs;
|
|
19
19
|
fieldName: string;
|
|
@@ -26,8 +26,8 @@ export interface TraceDetails {
|
|
|
26
26
|
service?: string;
|
|
27
27
|
skipped?: boolean;
|
|
28
28
|
step: string;
|
|
29
|
-
}
|
|
30
|
-
export
|
|
29
|
+
};
|
|
30
|
+
export type TraceReport = {
|
|
31
31
|
args?: ResolverArgs;
|
|
32
32
|
children: TraceReport[];
|
|
33
33
|
duration?: number;
|
|
@@ -46,6 +46,6 @@ export interface TraceReport {
|
|
|
46
46
|
step?: string;
|
|
47
47
|
steps?: TraceStepReport[];
|
|
48
48
|
traceClockStart?: number;
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
50
|
export type TraceStepReport = Pick<TraceReport, 'id' | 'name' | 'args' | 'step' | 'result' | 'duration' | 'service' | 'skipped' | 'request' | 'response' | 'fieldName'>;
|
|
51
51
|
//# sourceMappingURL=tracing.d.ts.map
|
package/dist/tracing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/tracing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE/C,MAAM,
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/tracing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,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Timeout(resolve, timeout, value);
|
|
3
3
|
});
|
|
4
4
|
function randomInt(minimum, maximum) {
|
|
5
|
-
// eslint-disable-next-line security-node/detect-insecure-randomness
|
|
6
5
|
const co = Math.random() * (maximum - minimum + 1);
|
|
7
6
|
return Math.floor(co + minimum);
|
|
8
7
|
}
|
package/es/draftjs-templates.js
CHANGED
package/es/draftjs.js
CHANGED
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { draftToMarkdown, markdownToDraft } from 'markdown-draft-js';
|
|
7
|
-
import { imageTemplate, imageTemplateMdx, oembedTemplate, oembedTemplateMdx } from './templates';
|
|
8
7
|
// With @types/htmlparser2 it says parseDOM is not exported; excluding types for now
|
|
9
8
|
// @ts-expect-error Untyped
|
|
10
9
|
import { parseDOM } from 'htmlparser2';
|
|
11
10
|
import Url from 'url-parse';
|
|
12
11
|
import render from 'dom-serializer';
|
|
13
12
|
import shortid from 'shortid';
|
|
14
|
-
import { getDraftjsImage, getDraftjsOembed, getDraftjsPullquote } from './draftjs-templates';
|
|
15
13
|
import escape from 'lodash/escape';
|
|
16
14
|
import unescape from 'lodash/unescape';
|
|
17
15
|
import pickBy from 'lodash/pickBy';
|
|
18
16
|
import { getImageUrl } from '@takeshape/routing';
|
|
19
17
|
import forEach from 'lodash/forEach';
|
|
20
18
|
import he from 'he';
|
|
19
|
+
import { getDraftjsImage, getDraftjsOembed, getDraftjsPullquote } from './draftjs-templates';
|
|
20
|
+
import { imageTemplate, imageTemplateMdx, oembedTemplate, oembedTemplateMdx } from './templates';
|
|
21
21
|
const SUPERSCRIPT_MARKER = 'TEMPORARY_SUPERSCRIPT_MARKER_TLfDNyf7VYKDduyL';
|
|
22
22
|
const SUBSCRIPT_MARKER = 'TEMPORARY_SUBSCRIPT_MARKER_K5VrdPEzyQyy2RcY';
|
|
23
23
|
const INSERT_MARKER = 'TEMPORARY_INSERT_MARKER_FSYdr8m8CS7YLb8y';
|
|
@@ -70,7 +70,7 @@ const handleExternalLinks = markdown => {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Adjust entity ranges to insert `amount` space starting at `after`.
|
|
73
|
+
* Adjust entity ranges or inline style ranges to insert `amount` space starting at `after`.
|
|
74
74
|
* For example, take this visualization of a range with offset 5 and length 5, where
|
|
75
75
|
* the vertical bars are the start and end of the range, inclusive:
|
|
76
76
|
* -----|---|-----
|
|
@@ -83,18 +83,17 @@ const handleExternalLinks = markdown => {
|
|
|
83
83
|
* If you insert amount -2 after 7 you get this:
|
|
84
84
|
* -----|-|-----
|
|
85
85
|
*/
|
|
86
|
-
export const
|
|
87
|
-
return
|
|
88
|
-
...
|
|
89
|
-
offset:
|
|
90
|
-
length:
|
|
86
|
+
export const adjustRanges = (ranges, after, amount) => {
|
|
87
|
+
return ranges.map(range => ({
|
|
88
|
+
...range,
|
|
89
|
+
offset: range.offset > after ? range.offset + amount : range.offset,
|
|
90
|
+
length: range.offset <= after && range.offset + range.length > after ? range.length + amount : range.length
|
|
91
91
|
}));
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Encode HTML entities in this draftjs state.
|
|
96
|
-
* We adjust
|
|
97
|
-
* encoded text.
|
|
96
|
+
* We adjust ranges so that their offsets and lengths are still correct with the encoded text.
|
|
98
97
|
* EG `'` is 5 characters longer than `'` so if there is a single apostrophe before a link,
|
|
99
98
|
* the link entity's offset needs to be increased by 5 when the text is encoded.
|
|
100
99
|
* This also applies to the entity's length if there are escaped characters inside the entity.
|
|
@@ -107,14 +106,16 @@ export const encodeHtmlEntities = draftjs => {
|
|
|
107
106
|
text
|
|
108
107
|
} = block;
|
|
109
108
|
let {
|
|
110
|
-
entityRanges
|
|
109
|
+
entityRanges,
|
|
110
|
+
inlineStyleRanges
|
|
111
111
|
} = block;
|
|
112
112
|
for (let i = 0; i < text.length; i++) {
|
|
113
113
|
const char = text.charAt(i);
|
|
114
114
|
const encodedChar = he.encode(char);
|
|
115
115
|
if (encodedChar !== char) {
|
|
116
116
|
const offset = encodedChar.length - char.length;
|
|
117
|
-
entityRanges =
|
|
117
|
+
entityRanges = adjustRanges(entityRanges, i, offset);
|
|
118
|
+
inlineStyleRanges = adjustRanges(inlineStyleRanges, i, offset);
|
|
118
119
|
text = text.substring(0, i) + encodedChar + text.substring(i + 1);
|
|
119
120
|
i += offset;
|
|
120
121
|
}
|
|
@@ -122,6 +123,7 @@ export const encodeHtmlEntities = draftjs => {
|
|
|
122
123
|
return {
|
|
123
124
|
...block,
|
|
124
125
|
entityRanges,
|
|
126
|
+
inlineStyleRanges,
|
|
125
127
|
text
|
|
126
128
|
};
|
|
127
129
|
})
|
|
@@ -196,7 +198,6 @@ export function fromDraftjs(draftjs, styleItems, entityItems) {
|
|
|
196
198
|
markdown = handleExternalLinks(markdown);
|
|
197
199
|
markdown = handleMultiword(markdown, SUPERSCRIPT_MARKER, '^', /\^/g);
|
|
198
200
|
markdown = handleMultiword(markdown, SUBSCRIPT_MARKER, '~', /~/g);
|
|
199
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
200
201
|
markdown = markdown.replace(/\+/g, '\\+').replace(new RegExp(INSERT_MARKER, 'g'), '++');
|
|
201
202
|
return markdown;
|
|
202
203
|
}
|
|
@@ -686,7 +687,6 @@ const blockEnds = [{
|
|
|
686
687
|
}];
|
|
687
688
|
const getLookBehindValue = (end, str) => {
|
|
688
689
|
if (end.lookBehind) {
|
|
689
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
690
690
|
const behindMatch = new RegExp(end.lookBehind).exec(str);
|
|
691
691
|
if (behindMatch) {
|
|
692
692
|
return behindMatch[0];
|
|
@@ -700,18 +700,14 @@ const getLookBehindValue = (end, str) => {
|
|
|
700
700
|
*/
|
|
701
701
|
export function insertBreaksAroundBlocks(mdx) {
|
|
702
702
|
for (const start of blockStarts) {
|
|
703
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
704
703
|
mdx = mdx.replace(new RegExp(`^${start.regex}`, 'g'), `<br/>\n\n${start.replacement}`);
|
|
705
704
|
}
|
|
706
705
|
for (const end of blockEnds) {
|
|
707
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
708
706
|
mdx = mdx.replace(new RegExp(`${end.lookBehind ?? ''}${end.regex}\\s*$`, 'g'), match => {
|
|
709
707
|
return `${getLookBehindValue(end, match)}${end.replacement}\n\n<br/>`;
|
|
710
708
|
});
|
|
711
709
|
for (const start of blockStarts) {
|
|
712
|
-
mdx = mdx.replace(
|
|
713
|
-
// eslint-disable-next-line security-node/non-literal-reg-expr
|
|
714
|
-
new RegExp(`${end.lookBehind ?? ''}${end.regex}\\s*${start.regex}`, 'g'), match => {
|
|
710
|
+
mdx = mdx.replace(new RegExp(`${end.lookBehind ?? ''}${end.regex}\\s*${start.regex}`, 'g'), match => {
|
|
715
711
|
return `${getLookBehindValue(end, match)}${end.replacement ?? 'FFF'}\n\n<br/>\n\n${start.replacement}`;
|
|
716
712
|
});
|
|
717
713
|
}
|
package/es/gzip.js
CHANGED
package/es/templates.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* to be shared between the draftjs / mdx implementations, which span the client / server differently.
|
|
4
4
|
*/
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import { highlightCode } from './highlight-code';
|
|
7
6
|
import escape from 'lodash/escape';
|
|
8
7
|
import { getImageUrl } from '@takeshape/routing';
|
|
8
|
+
import { highlightCode } from './highlight-code';
|
|
9
9
|
export function getApplyPrefix(prefix) {
|
|
10
10
|
return className => className ? prefix + className : '';
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/util",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.14",
|
|
4
4
|
"description": "Shared utilities",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"shortid": "^2.2.16",
|
|
34
34
|
"tiny-invariant": "^1.2.0",
|
|
35
35
|
"url-parse": "^1.5.3",
|
|
36
|
-
"@takeshape/routing": "10.4.
|
|
36
|
+
"@takeshape/routing": "10.4.14"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/classnames": "^2.2.9",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/prismjs": "^1.16.2",
|
|
47
47
|
"@types/shortid": "^0.0.29",
|
|
48
48
|
"stripe": "13.8.0",
|
|
49
|
-
"@takeshape/typescript-jest-junit-reporter": "10.4.
|
|
49
|
+
"@takeshape/typescript-jest-junit-reporter": "10.4.14"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=18"
|