@drttix/drt-sdk 0.6.1 → 0.6.4
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/azure-pipelines.yml +71 -0
- package/demo/test.html +240 -0
- package/dist/cjs/src/functions/sdkConfig.d.ts +55 -0
- package/dist/cjs/src/functions/sdkConfig.js +111 -0
- package/dist/cjs/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/portal/index.d.ts +1 -1
- package/dist/cjs/src/generated/portal/models/BlockedSeatDetailResponseDto.d.ts +10 -0
- package/dist/cjs/src/generated/portal/models/BlockedSeatDetailResponseDto.js +2 -0
- package/dist/cjs/src/generated/portal/services/FeaturesBlockedSeatsService.d.ts +3 -3
- package/dist/cjs/src/generated/portal/services/FeaturesBlockedSeatsService.js +1 -1
- package/dist/cjs/src/generated/portal/types.d.ts +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/src/definitions/portal.js +30 -30
- package/dist/esm/src/definitions/scanner.js +4 -4
- package/dist/esm/src/definitions/shopper.js +13 -13
- package/dist/esm/src/functions/sdkConfig.d.ts +55 -0
- package/dist/esm/src/functions/sdkConfig.js +103 -0
- package/dist/esm/src/functions/setBaseURL.js +3 -3
- package/dist/esm/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/portal/core/request.js +2 -2
- package/dist/esm/src/generated/portal/index.d.ts +1 -1
- package/dist/esm/src/generated/portal/index.js +32 -32
- package/dist/esm/src/generated/portal/models/BlockedSeatDetailResponseDto.d.ts +10 -0
- package/dist/esm/src/generated/portal/models/BlockedSeatDetailResponseDto.js +1 -0
- package/dist/esm/src/generated/portal/services/AccountService.js +2 -2
- package/dist/esm/src/generated/portal/services/AccountingService.js +2 -2
- package/dist/esm/src/generated/portal/services/AppService.js +2 -2
- package/dist/esm/src/generated/portal/services/AuthService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsGeneratedEmailsService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsParentLetterService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsPatronDatabaseService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsSeatAssignmentToolService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsStripeOnboardingService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsThemeBuilderService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsThemesLibraryService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsTicketScanningService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsTicketingLinkService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsUnapprovedOrdersService.js +2 -2
- package/dist/esm/src/generated/portal/services/ClientToolsWaitlistService.js +2 -2
- package/dist/esm/src/generated/portal/services/DashboardService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesBlockedSeatsService.d.ts +3 -3
- package/dist/esm/src/generated/portal/services/FeaturesBlockedSeatsService.js +3 -3
- package/dist/esm/src/generated/portal/services/FeaturesCheckoutQuestionsService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesDiscountsService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesDonationsService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesGiftCardsService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesGoldenTicketsService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesLandingPageService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesPriorityService.js +2 -2
- package/dist/esm/src/generated/portal/services/FeaturesProductsService.js +2 -2
- package/dist/esm/src/generated/portal/services/OrderLookupService.js +2 -2
- package/dist/esm/src/generated/portal/services/ReportsService.js +2 -2
- package/dist/esm/src/generated/portal/services/SettingsService.js +2 -2
- package/dist/esm/src/generated/portal/services/ShowsService.js +2 -2
- package/dist/esm/src/generated/portal/types.d.ts +1 -1
- package/dist/esm/src/generated/scanner/core/request.js +2 -2
- package/dist/esm/src/generated/scanner/index.js +6 -6
- package/dist/esm/src/generated/scanner/services/DatabaseService.js +2 -2
- package/dist/esm/src/generated/scanner/services/OrdersService.js +2 -2
- package/dist/esm/src/generated/scanner/services/ScanningService.js +2 -2
- package/dist/esm/src/generated/shopper/core/request.js +2 -2
- package/dist/esm/src/generated/shopper/index.js +15 -15
- package/dist/esm/src/generated/shopper/services/AccountService.js +2 -2
- package/dist/esm/src/generated/shopper/services/CartService.js +2 -2
- package/dist/esm/src/generated/shopper/services/CheckoutService.js +2 -2
- package/dist/esm/src/generated/shopper/services/CodeService.js +2 -2
- package/dist/esm/src/generated/shopper/services/DonationService.js +2 -2
- package/dist/esm/src/generated/shopper/services/EventService.js +2 -2
- package/dist/esm/src/generated/shopper/services/GiftCardService.js +2 -2
- package/dist/esm/src/generated/shopper/services/OrderService.js +2 -2
- package/dist/esm/src/generated/shopper/services/PaymentService.js +2 -2
- package/dist/esm/src/generated/shopper/services/ProductService.js +2 -2
- package/dist/esm/src/generated/shopper/services/SeatService.js +2 -2
- package/dist/esm/src/generated/shopper/services/SessionService.js +2 -2
- package/dist/esm/src/scripts/build-all.js +3 -3
- package/dist/esm/src/scripts/generate-definition.js +4 -4
- package/package.json +2 -2
- package/scripts/fix-import-extensions.mjs +36 -7
- package/src/functions/sdkConfig.ts +132 -0
- package/src/generated/portal/core/OpenAPI.ts +1 -1
- package/src/generated/portal/index.ts +1 -1
- package/src/generated/portal/models/{BlockedSeatDetail.ts → BlockedSeatDetailResponseDto.ts} +2 -1
- package/src/generated/portal/services/FeaturesBlockedSeatsService.ts +3 -3
- package/src/generated/portal/types.ts +1 -1
- package/test.ts +2 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
trigger:
|
|
2
|
+
branches:
|
|
3
|
+
include:
|
|
4
|
+
- main
|
|
5
|
+
- master
|
|
6
|
+
tags:
|
|
7
|
+
include:
|
|
8
|
+
- v*
|
|
9
|
+
|
|
10
|
+
variables:
|
|
11
|
+
- name: CLOUDFRONT_DISTRIBUTION_ID
|
|
12
|
+
value: 'E3QF4Y9HVWHQH5'
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- task: NodeTool@0
|
|
16
|
+
displayName: 'Install Node.js'
|
|
17
|
+
inputs:
|
|
18
|
+
versionSpec: '18.x'
|
|
19
|
+
|
|
20
|
+
- script: |
|
|
21
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
22
|
+
echo "##vso[task.setvariable variable=VERSION]$VERSION"
|
|
23
|
+
echo "Building version: $VERSION"
|
|
24
|
+
displayName: 'Read version from package.json'
|
|
25
|
+
|
|
26
|
+
- task: AWSShellScript@1
|
|
27
|
+
displayName: 'Check if version already exists'
|
|
28
|
+
inputs:
|
|
29
|
+
awsCredentials: 'AWS'
|
|
30
|
+
regionName: 'us-east-1'
|
|
31
|
+
scriptType: 'inline'
|
|
32
|
+
inlineScript: |
|
|
33
|
+
if aws s3 ls s3://drt-public-assets/sdk/$(VERSION)/ 2>/dev/null; then
|
|
34
|
+
echo "ERROR: Version $(VERSION) already exists in S3!"
|
|
35
|
+
echo "Please increment the version in package.json before publishing."
|
|
36
|
+
exit 1
|
|
37
|
+
else
|
|
38
|
+
echo "Version $(VERSION) is new and can be published."
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
- script: |
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
displayName: 'Install dependencies and build'
|
|
45
|
+
|
|
46
|
+
- task: AWSShellScript@1
|
|
47
|
+
displayName: 'Upload versioned files'
|
|
48
|
+
inputs:
|
|
49
|
+
awsCredentials: 'AWS'
|
|
50
|
+
regionName: 'us-east-1'
|
|
51
|
+
scriptType: 'inline'
|
|
52
|
+
inlineScript: |
|
|
53
|
+
aws s3 sync $(Build.SourcesDirectory)/dist/esm s3://drt-public-assets/sdk/$(VERSION) --exclude "*" --include "*.js" --include "*.d.ts"
|
|
54
|
+
|
|
55
|
+
- task: AWSShellScript@1
|
|
56
|
+
displayName: 'Upload to latest'
|
|
57
|
+
inputs:
|
|
58
|
+
awsCredentials: 'AWS'
|
|
59
|
+
regionName: 'us-east-1'
|
|
60
|
+
scriptType: 'inline'
|
|
61
|
+
inlineScript: |
|
|
62
|
+
aws s3 sync $(Build.SourcesDirectory)/dist/esm s3://drt-public-assets/sdk/latest --exclude "*" --include "*.js" --include "*.d.ts" --delete
|
|
63
|
+
|
|
64
|
+
- task: AWSShellScript@1
|
|
65
|
+
displayName: 'Invalidate CloudFront cache'
|
|
66
|
+
inputs:
|
|
67
|
+
awsCredentials: 'AWS'
|
|
68
|
+
regionName: 'us-east-1'
|
|
69
|
+
scriptType: 'inline'
|
|
70
|
+
inlineScript: |
|
|
71
|
+
aws cloudfront create-invalidation --distribution-id $(CLOUDFRONT_DISTRIBUTION_ID) --paths "/sdk/latest/*"
|
package/demo/test.html
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>DRT SDK Test Page</title>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
font-family: system-ui, sans-serif;
|
|
9
|
+
max-width: 900px;
|
|
10
|
+
margin: 2rem auto;
|
|
11
|
+
padding: 0 1rem;
|
|
12
|
+
}
|
|
13
|
+
h1 {
|
|
14
|
+
color: #333;
|
|
15
|
+
}
|
|
16
|
+
h2 {
|
|
17
|
+
color: #555;
|
|
18
|
+
margin-top: 2rem;
|
|
19
|
+
}
|
|
20
|
+
button {
|
|
21
|
+
padding: 0.5rem 1rem;
|
|
22
|
+
font-size: 1rem;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin: 0.25rem;
|
|
25
|
+
}
|
|
26
|
+
pre {
|
|
27
|
+
background: #f4f4f4;
|
|
28
|
+
padding: 1rem;
|
|
29
|
+
overflow: auto;
|
|
30
|
+
border-radius: 4px;
|
|
31
|
+
max-height: 400px;
|
|
32
|
+
}
|
|
33
|
+
.success {
|
|
34
|
+
color: green;
|
|
35
|
+
}
|
|
36
|
+
.error {
|
|
37
|
+
color: red;
|
|
38
|
+
}
|
|
39
|
+
#status {
|
|
40
|
+
margin: 1rem 0;
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
}
|
|
43
|
+
.config-form {
|
|
44
|
+
background: #f9f9f9;
|
|
45
|
+
padding: 1rem;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
margin-bottom: 1rem;
|
|
48
|
+
}
|
|
49
|
+
.config-form label {
|
|
50
|
+
display: block;
|
|
51
|
+
margin: 0.5rem 0 0.25rem;
|
|
52
|
+
}
|
|
53
|
+
.config-form input {
|
|
54
|
+
width: 100%;
|
|
55
|
+
padding: 0.5rem;
|
|
56
|
+
font-size: 1rem;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
60
|
+
</head>
|
|
61
|
+
<body>
|
|
62
|
+
<h1>DRT SDK Test Page</h1>
|
|
63
|
+
|
|
64
|
+
<h2>1. Initialize SDK</h2>
|
|
65
|
+
<div class="config-form">
|
|
66
|
+
<label for="shopperGuid">Shopper GUID:</label>
|
|
67
|
+
<input
|
|
68
|
+
type="text"
|
|
69
|
+
id="shopperGuid"
|
|
70
|
+
placeholder="e.g., F1199DCD-BB45-4BD0-8DED600A3A234C75"
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<label for="accountId">Account ID:</label>
|
|
74
|
+
<input type="text" id="accountId" placeholder="e.g., 508" />
|
|
75
|
+
|
|
76
|
+
<label for="apiKey">API Key:</label>
|
|
77
|
+
<input type="text" id="apiKey" placeholder="e.g., your-api-key" />
|
|
78
|
+
|
|
79
|
+
<button id="btn-init" style="margin-top: 1rem">
|
|
80
|
+
Initialize SDK
|
|
81
|
+
</button>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<h2>2. Test API Calls</h2>
|
|
85
|
+
<p>
|
|
86
|
+
After initializing, these calls will automatically use your
|
|
87
|
+
credentials.
|
|
88
|
+
</p>
|
|
89
|
+
<div>
|
|
90
|
+
<button id="btn-check-sdk">Check SDK Status</button>
|
|
91
|
+
<button id="btn-strings">Get Scanner Strings (no auth)</button>
|
|
92
|
+
<button id="btn-theme">Get Theme (requires auth)</button>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div id="status"></div>
|
|
96
|
+
<pre id="output">
|
|
97
|
+
Initialize the SDK above, then click a button to test...</pre
|
|
98
|
+
>
|
|
99
|
+
|
|
100
|
+
<script type="module">
|
|
101
|
+
import { DRT } from '../dist/esm/index.js';
|
|
102
|
+
|
|
103
|
+
const out = document.getElementById('output');
|
|
104
|
+
const status = document.getElementById('status');
|
|
105
|
+
|
|
106
|
+
function setStatus(msg, isError = false) {
|
|
107
|
+
status.textContent = msg;
|
|
108
|
+
status.className = isError ? 'error' : 'success';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function setOutput(data) {
|
|
112
|
+
out.textContent =
|
|
113
|
+
typeof data === 'string'
|
|
114
|
+
? data
|
|
115
|
+
: JSON.stringify(data, null, 2);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Expose DRT globally for console testing
|
|
119
|
+
window.DRT = DRT;
|
|
120
|
+
|
|
121
|
+
// Initialize SDK
|
|
122
|
+
document
|
|
123
|
+
.getElementById('btn-init')
|
|
124
|
+
.addEventListener('click', () => {
|
|
125
|
+
const shopperGuid = document
|
|
126
|
+
.getElementById('shopperGuid')
|
|
127
|
+
.value.trim();
|
|
128
|
+
const accountId = document
|
|
129
|
+
.getElementById('accountId')
|
|
130
|
+
.value.trim();
|
|
131
|
+
const apiKey = document
|
|
132
|
+
.getElementById('apiKey')
|
|
133
|
+
.value.trim();
|
|
134
|
+
|
|
135
|
+
if (!shopperGuid || !accountId || !apiKey) {
|
|
136
|
+
setStatus('Please fill in all fields', true);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
DRT.init({
|
|
142
|
+
shopperGuid,
|
|
143
|
+
accountId,
|
|
144
|
+
apiKey,
|
|
145
|
+
});
|
|
146
|
+
setStatus('SDK Initialized!', false);
|
|
147
|
+
setOutput({
|
|
148
|
+
message: 'SDK initialized successfully!',
|
|
149
|
+
config: {
|
|
150
|
+
shopperGuid,
|
|
151
|
+
accountId,
|
|
152
|
+
apiKey: '***', // Don't show full key
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
} catch (err) {
|
|
156
|
+
setStatus('Init failed: ' + err.message, true);
|
|
157
|
+
setOutput({ error: err.message });
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Check SDK status
|
|
162
|
+
document
|
|
163
|
+
.getElementById('btn-check-sdk')
|
|
164
|
+
.addEventListener('click', () => {
|
|
165
|
+
setStatus('SDK Status', false);
|
|
166
|
+
const config = DRT.getConfig();
|
|
167
|
+
setOutput({
|
|
168
|
+
isReady: DRT.isReady(),
|
|
169
|
+
config: config
|
|
170
|
+
? {
|
|
171
|
+
shopperGuid: config.shopperGuid,
|
|
172
|
+
accountId: config.accountId,
|
|
173
|
+
apiKey: '***',
|
|
174
|
+
}
|
|
175
|
+
: null,
|
|
176
|
+
availableServices: {
|
|
177
|
+
shopper: Object.keys(DRT.shopper),
|
|
178
|
+
scanner: Object.keys(DRT.scanner),
|
|
179
|
+
portal: Object.keys(DRT.portal),
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Get scanner strings (no auth required)
|
|
185
|
+
document
|
|
186
|
+
.getElementById('btn-strings')
|
|
187
|
+
.addEventListener('click', async () => {
|
|
188
|
+
setStatus('Fetching...', false);
|
|
189
|
+
try {
|
|
190
|
+
const strings =
|
|
191
|
+
await DRT.scanner.scanning.appControllerGetStrings();
|
|
192
|
+
setStatus('Success!', false);
|
|
193
|
+
setOutput(strings);
|
|
194
|
+
} catch (err) {
|
|
195
|
+
setStatus('Error: ' + err.message, true);
|
|
196
|
+
setOutput({
|
|
197
|
+
error: err.message,
|
|
198
|
+
details: err.toString(),
|
|
199
|
+
});
|
|
200
|
+
console.error(err);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Get theme (requires auth - credentials auto-injected after init!)
|
|
205
|
+
document
|
|
206
|
+
.getElementById('btn-theme')
|
|
207
|
+
.addEventListener('click', async () => {
|
|
208
|
+
if (!DRT.isReady()) {
|
|
209
|
+
setStatus(
|
|
210
|
+
'SDK not initialized! Please initialize first.',
|
|
211
|
+
true,
|
|
212
|
+
);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
setStatus('Fetching theme...', false);
|
|
217
|
+
try {
|
|
218
|
+
// After DRT.init(), credentials are automatically injected - no params needed!
|
|
219
|
+
const theme = await DRT.shopper.account.getTheme();
|
|
220
|
+
setStatus('Success!', false);
|
|
221
|
+
setOutput(theme);
|
|
222
|
+
} catch (err) {
|
|
223
|
+
setStatus('Error: ' + err.message, true);
|
|
224
|
+
setOutput({
|
|
225
|
+
error: err.message,
|
|
226
|
+
details: err.toString(),
|
|
227
|
+
});
|
|
228
|
+
console.error(err);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// Auto-check on load
|
|
233
|
+
setStatus(
|
|
234
|
+
'SDK loaded! Initialize with your credentials above.',
|
|
235
|
+
false,
|
|
236
|
+
);
|
|
237
|
+
console.log('DRT SDK available at window.DRT for console testing');
|
|
238
|
+
</script>
|
|
239
|
+
</body>
|
|
240
|
+
</html>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface SDKConfig {
|
|
2
|
+
shopperGuid: string;
|
|
3
|
+
accountId: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Initialize the DRT SDK with credentials.
|
|
8
|
+
* Once initialized, these credentials will be automatically included
|
|
9
|
+
* in all API requests as headers.
|
|
10
|
+
*
|
|
11
|
+
* @param config - The SDK configuration containing shopperGuid, accountId, and apiKey
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```javascript
|
|
15
|
+
* import { DRT } from '@drttix/drt-sdk';
|
|
16
|
+
*
|
|
17
|
+
* // Initialize once
|
|
18
|
+
* DRT.init({
|
|
19
|
+
* shopperGuid: 'your-shopper-guid',
|
|
20
|
+
* accountId: 'your-account-id',
|
|
21
|
+
* apiKey: 'your-api-key'
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Now make calls without passing credentials
|
|
25
|
+
* const theme = await DRT.shopper.account.getTheme();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function init(config: SDKConfig): void;
|
|
29
|
+
/**
|
|
30
|
+
* Check if the SDK has been initialized with credentials.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isReady(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get the current SDK configuration (if initialized).
|
|
35
|
+
*/
|
|
36
|
+
export declare function getConfig(): SDKConfig | null;
|
|
37
|
+
/**
|
|
38
|
+
* Reset the SDK configuration.
|
|
39
|
+
*/
|
|
40
|
+
export declare function reset(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get credentials from config, throwing if not initialized.
|
|
43
|
+
* Used internally by wrapped services.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCredentials(): {
|
|
46
|
+
shopperGuid: string;
|
|
47
|
+
accountId: string;
|
|
48
|
+
apiKey: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Creates a proxy that auto-injects credentials for service methods.
|
|
52
|
+
* Methods that take (shopperguid, accountid, apikey, ...rest) as first 3 params
|
|
53
|
+
* will have those auto-filled from the SDK config.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createAutoCredentialsProxy<T extends object>(service: T): T;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.init = init;
|
|
4
|
+
exports.isReady = isReady;
|
|
5
|
+
exports.getConfig = getConfig;
|
|
6
|
+
exports.reset = reset;
|
|
7
|
+
exports.getCredentials = getCredentials;
|
|
8
|
+
exports.createAutoCredentialsProxy = createAutoCredentialsProxy;
|
|
9
|
+
// SDK Configuration - allows initializing credentials once
|
|
10
|
+
const OpenAPI_1 = require("../generated/shopper/core/OpenAPI");
|
|
11
|
+
const OpenAPI_2 = require("../generated/scanner/core/OpenAPI");
|
|
12
|
+
const OpenAPI_3 = require("../generated/portal/core/OpenAPI");
|
|
13
|
+
let isInitialized = false;
|
|
14
|
+
let currentConfig = null;
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the DRT SDK with credentials.
|
|
17
|
+
* Once initialized, these credentials will be automatically included
|
|
18
|
+
* in all API requests as headers.
|
|
19
|
+
*
|
|
20
|
+
* @param config - The SDK configuration containing shopperGuid, accountId, and apiKey
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```javascript
|
|
24
|
+
* import { DRT } from '@drttix/drt-sdk';
|
|
25
|
+
*
|
|
26
|
+
* // Initialize once
|
|
27
|
+
* DRT.init({
|
|
28
|
+
* shopperGuid: 'your-shopper-guid',
|
|
29
|
+
* accountId: 'your-account-id',
|
|
30
|
+
* apiKey: 'your-api-key'
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Now make calls without passing credentials
|
|
34
|
+
* const theme = await DRT.shopper.account.getTheme();
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function init(config) {
|
|
38
|
+
if (!config.shopperGuid || !config.accountId || !config.apiKey) {
|
|
39
|
+
throw new Error('DRT SDK init requires shopperGuid, accountId, and apiKey');
|
|
40
|
+
}
|
|
41
|
+
currentConfig = config;
|
|
42
|
+
const headers = {
|
|
43
|
+
shopperguid: config.shopperGuid,
|
|
44
|
+
accountid: config.accountId,
|
|
45
|
+
apikey: config.apiKey,
|
|
46
|
+
};
|
|
47
|
+
// Set headers on all API clients
|
|
48
|
+
OpenAPI_1.OpenAPI.HEADERS = headers;
|
|
49
|
+
OpenAPI_2.OpenAPI.HEADERS = headers;
|
|
50
|
+
OpenAPI_3.OpenAPI.HEADERS = headers;
|
|
51
|
+
isInitialized = true;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if the SDK has been initialized with credentials.
|
|
55
|
+
*/
|
|
56
|
+
function isReady() {
|
|
57
|
+
return isInitialized;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the current SDK configuration (if initialized).
|
|
61
|
+
*/
|
|
62
|
+
function getConfig() {
|
|
63
|
+
return currentConfig;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Reset the SDK configuration.
|
|
67
|
+
*/
|
|
68
|
+
function reset() {
|
|
69
|
+
currentConfig = null;
|
|
70
|
+
isInitialized = false;
|
|
71
|
+
OpenAPI_1.OpenAPI.HEADERS = undefined;
|
|
72
|
+
OpenAPI_2.OpenAPI.HEADERS = undefined;
|
|
73
|
+
OpenAPI_3.OpenAPI.HEADERS = undefined;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get credentials from config, throwing if not initialized.
|
|
77
|
+
* Used internally by wrapped services.
|
|
78
|
+
*/
|
|
79
|
+
function getCredentials() {
|
|
80
|
+
if (!currentConfig) {
|
|
81
|
+
throw new Error('DRT SDK not initialized. Call DRT.init() first.');
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
shopperGuid: currentConfig.shopperGuid,
|
|
85
|
+
accountId: currentConfig.accountId,
|
|
86
|
+
apiKey: currentConfig.apiKey,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates a proxy that auto-injects credentials for service methods.
|
|
91
|
+
* Methods that take (shopperguid, accountid, apikey, ...rest) as first 3 params
|
|
92
|
+
* will have those auto-filled from the SDK config.
|
|
93
|
+
*/
|
|
94
|
+
function createAutoCredentialsProxy(service) {
|
|
95
|
+
return new Proxy(service, {
|
|
96
|
+
get(target, prop) {
|
|
97
|
+
const value = target[prop];
|
|
98
|
+
if (typeof value === 'function') {
|
|
99
|
+
return (...args) => {
|
|
100
|
+
// If SDK is initialized, prepend credentials
|
|
101
|
+
if (isInitialized && currentConfig) {
|
|
102
|
+
return value.call(target, currentConfig.shopperGuid, currentConfig.accountId, currentConfig.apiKey, ...args);
|
|
103
|
+
}
|
|
104
|
+
// Otherwise call with original args
|
|
105
|
+
return value.apply(target, args);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return value;
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -18,7 +18,7 @@ export type { AutoDiscounts } from './models/AutoDiscounts';
|
|
|
18
18
|
export type { AvaliableSeats } from './models/AvaliableSeats';
|
|
19
19
|
export type { BankDetails } from './models/BankDetails';
|
|
20
20
|
export type { BlockChartSeatRequestDto } from './models/BlockChartSeatRequestDto';
|
|
21
|
-
export type {
|
|
21
|
+
export type { BlockedSeatDetailResponseDto } from './models/BlockedSeatDetailResponseDto';
|
|
22
22
|
export type { BlockGeneralSeatResponseDto } from './models/BlockGeneralSeatResponseDto';
|
|
23
23
|
export type { BlockGeneralSeatsRequestDto } from './models/BlockGeneralSeatsRequestDto';
|
|
24
24
|
export type { BlockSeatsRequestDto } from './models/BlockSeatsRequestDto';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssignSeatsRequestDto } from '../models/AssignSeatsRequestDto';
|
|
2
2
|
import type { BlockChartSeatRequestDto } from '../models/BlockChartSeatRequestDto';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BlockedSeatDetailResponseDto } from '../models/BlockedSeatDetailResponseDto';
|
|
4
4
|
import type { BlockGeneralSeatResponseDto } from '../models/BlockGeneralSeatResponseDto';
|
|
5
5
|
import type { BlockGeneralSeatsRequestDto } from '../models/BlockGeneralSeatsRequestDto';
|
|
6
6
|
import type { BlockSeatsRequestDto } from '../models/BlockSeatsRequestDto';
|
|
@@ -60,10 +60,10 @@ export declare class FeaturesBlockedSeatsService {
|
|
|
60
60
|
/**
|
|
61
61
|
* Fetch the selected seats
|
|
62
62
|
* Fetch the selected seats
|
|
63
|
-
* @returns
|
|
63
|
+
* @returns BlockedSeatDetailResponseDto Selected seats fetched successfully
|
|
64
64
|
* @throws ApiError
|
|
65
65
|
*/
|
|
66
|
-
static getSelectedSeats(): CancelablePromise<Array<
|
|
66
|
+
static getSelectedSeats(): CancelablePromise<Array<BlockedSeatDetailResponseDto>>;
|
|
67
67
|
/**
|
|
68
68
|
* Initialize the seat engine for a show
|
|
69
69
|
* Initialize the seat engine for a show
|
|
@@ -79,7 +79,7 @@ class FeaturesBlockedSeatsService {
|
|
|
79
79
|
/**
|
|
80
80
|
* Fetch the selected seats
|
|
81
81
|
* Fetch the selected seats
|
|
82
|
-
* @returns
|
|
82
|
+
* @returns BlockedSeatDetailResponseDto Selected seats fetched successfully
|
|
83
83
|
* @throws ApiError
|
|
84
84
|
*/
|
|
85
85
|
static getSelectedSeats() {
|
|
@@ -14,7 +14,7 @@ export type { AutoDiscounts } from './models/AutoDiscounts';
|
|
|
14
14
|
export type { AvaliableSeats } from './models/AvaliableSeats';
|
|
15
15
|
export type { BankDetails } from './models/BankDetails';
|
|
16
16
|
export type { BlockChartSeatRequestDto } from './models/BlockChartSeatRequestDto';
|
|
17
|
-
export type {
|
|
17
|
+
export type { BlockedSeatDetailResponseDto } from './models/BlockedSeatDetailResponseDto';
|
|
18
18
|
export type { BlockGeneralSeatResponseDto } from './models/BlockGeneralSeatResponseDto';
|
|
19
19
|
export type { BlockGeneralSeatsRequestDto } from './models/BlockGeneralSeatsRequestDto';
|
|
20
20
|
export type { BlockSeatsRequestDto } from './models/BlockSeatsRequestDto';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// AUTO-GENERATED FILE – DO NOT EDIT
|
|
2
|
-
import { shopper } from "./src/definitions/shopper";
|
|
3
|
-
import { scanner } from "./src/definitions/scanner";
|
|
4
|
-
import { portal } from "./src/definitions/portal";
|
|
5
|
-
import { setBaseUrlsOnce } from "./src/functions/setBaseURL";
|
|
6
|
-
export { ShopperTypes } from "./src/definitions/shopper";
|
|
7
|
-
export { ScannerTypes } from "./src/definitions/scanner";
|
|
8
|
-
export { PortalTypes } from "./src/definitions/portal";
|
|
2
|
+
import { shopper } from "./src/definitions/shopper.js";
|
|
3
|
+
import { scanner } from "./src/definitions/scanner.js";
|
|
4
|
+
import { portal } from "./src/definitions/portal.js";
|
|
5
|
+
import { setBaseUrlsOnce } from "./src/functions/setBaseURL.js";
|
|
6
|
+
export { ShopperTypes } from "./src/definitions/shopper.js";
|
|
7
|
+
export { ScannerTypes } from "./src/definitions/scanner.js";
|
|
8
|
+
export { PortalTypes } from "./src/definitions/portal.js";
|
|
9
9
|
export const DRT = {
|
|
10
10
|
shopper,
|
|
11
11
|
scanner,
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
// AUTO-GENERATED FILE – DO NOT EDIT
|
|
2
|
-
import { AccountService } from "../generated/portal";
|
|
3
|
-
import { AccountingService } from "../generated/portal";
|
|
4
|
-
import { AppService } from "../generated/portal";
|
|
5
|
-
import { AuthService } from "../generated/portal";
|
|
6
|
-
import { ClientToolsGeneratedEmailsService } from "../generated/portal";
|
|
7
|
-
import { ClientToolsParentLetterService } from "../generated/portal";
|
|
8
|
-
import { ClientToolsPatronDatabaseService } from "../generated/portal";
|
|
9
|
-
import { ClientToolsSeatAssignmentToolService } from "../generated/portal";
|
|
10
|
-
import { ClientToolsStripeOnboardingService } from "../generated/portal";
|
|
11
|
-
import { ClientToolsThemeBuilderService } from "../generated/portal";
|
|
12
|
-
import { ClientToolsThemesLibraryService } from "../generated/portal";
|
|
13
|
-
import { ClientToolsTicketingLinkService } from "../generated/portal";
|
|
14
|
-
import { ClientToolsTicketScanningService } from "../generated/portal";
|
|
15
|
-
import { ClientToolsUnapprovedOrdersService } from "../generated/portal";
|
|
16
|
-
import { ClientToolsWaitlistService } from "../generated/portal";
|
|
17
|
-
import { DashboardService } from "../generated/portal";
|
|
18
|
-
import { FeaturesBlockedSeatsService } from "../generated/portal";
|
|
19
|
-
import { FeaturesCheckoutQuestionsService } from "../generated/portal";
|
|
20
|
-
import { FeaturesDiscountsService } from "../generated/portal";
|
|
21
|
-
import { FeaturesDonationsService } from "../generated/portal";
|
|
22
|
-
import { FeaturesGiftCardsService } from "../generated/portal";
|
|
23
|
-
import { FeaturesGoldenTicketsService } from "../generated/portal";
|
|
24
|
-
import { FeaturesLandingPageService } from "../generated/portal";
|
|
25
|
-
import { FeaturesPriorityService } from "../generated/portal";
|
|
26
|
-
import { FeaturesProductsService } from "../generated/portal";
|
|
27
|
-
import { OrderLookupService } from "../generated/portal";
|
|
28
|
-
import { ReportsService } from "../generated/portal";
|
|
29
|
-
import { SettingsService } from "../generated/portal";
|
|
30
|
-
import { ShowsService } from "../generated/portal";
|
|
2
|
+
import { AccountService } from "../generated/portal/index.js";
|
|
3
|
+
import { AccountingService } from "../generated/portal/index.js";
|
|
4
|
+
import { AppService } from "../generated/portal/index.js";
|
|
5
|
+
import { AuthService } from "../generated/portal/index.js";
|
|
6
|
+
import { ClientToolsGeneratedEmailsService } from "../generated/portal/index.js";
|
|
7
|
+
import { ClientToolsParentLetterService } from "../generated/portal/index.js";
|
|
8
|
+
import { ClientToolsPatronDatabaseService } from "../generated/portal/index.js";
|
|
9
|
+
import { ClientToolsSeatAssignmentToolService } from "../generated/portal/index.js";
|
|
10
|
+
import { ClientToolsStripeOnboardingService } from "../generated/portal/index.js";
|
|
11
|
+
import { ClientToolsThemeBuilderService } from "../generated/portal/index.js";
|
|
12
|
+
import { ClientToolsThemesLibraryService } from "../generated/portal/index.js";
|
|
13
|
+
import { ClientToolsTicketingLinkService } from "../generated/portal/index.js";
|
|
14
|
+
import { ClientToolsTicketScanningService } from "../generated/portal/index.js";
|
|
15
|
+
import { ClientToolsUnapprovedOrdersService } from "../generated/portal/index.js";
|
|
16
|
+
import { ClientToolsWaitlistService } from "../generated/portal/index.js";
|
|
17
|
+
import { DashboardService } from "../generated/portal/index.js";
|
|
18
|
+
import { FeaturesBlockedSeatsService } from "../generated/portal/index.js";
|
|
19
|
+
import { FeaturesCheckoutQuestionsService } from "../generated/portal/index.js";
|
|
20
|
+
import { FeaturesDiscountsService } from "../generated/portal/index.js";
|
|
21
|
+
import { FeaturesDonationsService } from "../generated/portal/index.js";
|
|
22
|
+
import { FeaturesGiftCardsService } from "../generated/portal/index.js";
|
|
23
|
+
import { FeaturesGoldenTicketsService } from "../generated/portal/index.js";
|
|
24
|
+
import { FeaturesLandingPageService } from "../generated/portal/index.js";
|
|
25
|
+
import { FeaturesPriorityService } from "../generated/portal/index.js";
|
|
26
|
+
import { FeaturesProductsService } from "../generated/portal/index.js";
|
|
27
|
+
import { OrderLookupService } from "../generated/portal/index.js";
|
|
28
|
+
import { ReportsService } from "../generated/portal/index.js";
|
|
29
|
+
import { SettingsService } from "../generated/portal/index.js";
|
|
30
|
+
import { ShowsService } from "../generated/portal/index.js";
|
|
31
31
|
export const portal = {
|
|
32
32
|
account: AccountService,
|
|
33
33
|
accounting: AccountingService,
|
|
@@ -60,4 +60,4 @@ export const portal = {
|
|
|
60
60
|
shows: ShowsService,
|
|
61
61
|
};
|
|
62
62
|
// Re-export all types as a namespace
|
|
63
|
-
export * as PortalTypes from "../generated/portal/types";
|
|
63
|
+
export * as PortalTypes from "../generated/portal/types.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// AUTO-GENERATED FILE – DO NOT EDIT
|
|
2
|
-
import { DatabaseService } from "../generated/scanner";
|
|
3
|
-
import { OrdersService } from "../generated/scanner";
|
|
4
|
-
import { ScanningService } from "../generated/scanner";
|
|
2
|
+
import { DatabaseService } from "../generated/scanner/index.js";
|
|
3
|
+
import { OrdersService } from "../generated/scanner/index.js";
|
|
4
|
+
import { ScanningService } from "../generated/scanner/index.js";
|
|
5
5
|
export const scanner = {
|
|
6
6
|
database: DatabaseService,
|
|
7
7
|
orders: OrdersService,
|
|
8
8
|
scanning: ScanningService,
|
|
9
9
|
};
|
|
10
10
|
// Re-export all types as a namespace
|
|
11
|
-
export * as ScannerTypes from "../generated/scanner/types";
|
|
11
|
+
export * as ScannerTypes from "../generated/scanner/types.js";
|