@d19n/youfibre-odin-sdk 2.0.1 → 2.0.2-beta.1
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/README.md +2 -1
- package/dist/actions-v2/AssignCaseDto.d.ts +5 -13
- package/dist/actions-v2/AssignCaseWithNoteFlowDto.d.ts +5 -13
- package/dist/actions-v2/CreateAuddisPgSubmissionAllocationDto.d.ts +8 -1
- package/dist/actions-v2/CreateBacsPgSubmissionAllocationDto.d.ts +11 -4
- package/dist/actions-v2/CreateCaseFromContactDto.d.ts +5 -13
- package/dist/actions-v2/CreateCashbackRewardForOrderReferralDto.d.ts +208 -0
- package/dist/actions-v2/CreateCashbackRewardForOrderReferralDto.js +179 -0
- package/dist/actions-v2/UpdateTeamDto.d.ts +15 -1
- package/dist/api-sdk-v2/ReferralApi.d.ts +2 -0
- package/dist/api-sdk-v2/ReferralApi.js +6 -0
- package/dist/api-sdk-v2/RewardApi.d.ts +2 -0
- package/dist/api-sdk-v2/RewardApi.js +6 -0
- package/dist/db-sdk-v2/ReferralDb.d.ts +2 -0
- package/dist/db-sdk-v2/ReferralDb.js +6 -0
- package/dist/db-sdk-v2/RewardDb.d.ts +2 -0
- package/dist/db-sdk-v2/RewardDb.js +6 -0
- package/dist/entities-v2/AccountCredit.d.ts +90 -7
- package/dist/entities-v2/AccountCredit.js +86 -3
- package/dist/entities-v2/Referral.d.ts +7 -0
- package/dist/entities-v2/Referral.js +5 -1
- package/dist/entities-v2/Reward.d.ts +3 -12
- package/dist/entities-v2/Reward.js +0 -2
- package/dist/entities-v2/Team.d.ts +21 -0
- package/dist/entities-v2/Team.js +17 -1
- package/dist/records-v2/ContactRecord.js +2 -0
- package/dist/records-v2/ReferralRecord.d.ts +20 -0
- package/dist/records-v2/ReferralRecord.js +33 -0
- package/dist/records-v2/RewardRecord.d.ts +49 -0
- package/dist/records-v2/RewardRecord.js +60 -0
- package/package.json +1 -1
|
@@ -24,10 +24,13 @@ import { IOdinProvider } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
|
|
|
24
24
|
import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
|
|
25
25
|
import { RewardProperties, CashbackRewardProperties } from '../entities-v2/Reward';
|
|
26
26
|
import { CreateCashbackRewardProperties } from '../actions-v2/CreateCashbackRewardDto';
|
|
27
|
+
import { CreateCashbackRewardForOrderReferralProperties } from '../actions-v2/CreateCashbackRewardForOrderReferralDto';
|
|
28
|
+
import { CreateCashbackRewardForOrderReferralBuilder } from '../actions-v2/CreateCashbackRewardForOrderReferralDto';
|
|
27
29
|
import { CampaignRecord } from './CampaignRecord';
|
|
28
30
|
import { ContactRecord } from './ContactRecord';
|
|
29
31
|
import { AffiliateCodeRecord } from './AffiliateCodeRecord';
|
|
30
32
|
import { PaymentMethodRefundRecord } from './PaymentMethodRefundRecord';
|
|
33
|
+
import { ReferralRecord } from './ReferralRecord';
|
|
31
34
|
/** Valid entity types for Reward */
|
|
32
35
|
export declare type RewardType = 'CASHBACK';
|
|
33
36
|
/**
|
|
@@ -97,6 +100,7 @@ export declare class RewardRecord<TProps = RewardProperties> {
|
|
|
97
100
|
private _contacts?;
|
|
98
101
|
private _affiliateCodes?;
|
|
99
102
|
private _paymentMethodRefunds?;
|
|
103
|
+
private _referrals?;
|
|
100
104
|
/**
|
|
101
105
|
* Create a record wrapper.
|
|
102
106
|
* @param record - The underlying record, or null for create operations
|
|
@@ -210,6 +214,24 @@ export declare class RewardRecord<TProps = RewardProperties> {
|
|
|
210
214
|
* ```
|
|
211
215
|
*/
|
|
212
216
|
get paymentMethodRefunds(): RecordLinkManager<PaymentMethodRefundRecord, typeof RewardRecord['paymentMethodRefundsLabels'][number]>;
|
|
217
|
+
/** Valid labels for Referral associations */
|
|
218
|
+
static readonly referralsLabels: readonly ["OrderReferralCashbackReward"];
|
|
219
|
+
/**
|
|
220
|
+
* Access linked Referral records
|
|
221
|
+
* @remarks Available labels: OrderReferralCashbackReward
|
|
222
|
+
* @throws Error if called on a new (unsaved) record
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* // Get all linked Referral records
|
|
227
|
+
* const items = await record.referrals.list();
|
|
228
|
+
* const first = await record.referrals.first();
|
|
229
|
+
*
|
|
230
|
+
* // Filter by label
|
|
231
|
+
* const specific = await record.referrals.first({ label: 'OrderReferralCashbackReward' });
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
get referrals(): RecordLinkManager<ReferralRecord, typeof RewardRecord['referralsLabels'][number]>;
|
|
213
235
|
/**
|
|
214
236
|
* Queue a link to be created with the next action.
|
|
215
237
|
* Works for both create and update actions.
|
|
@@ -259,6 +281,33 @@ export declare class RewardRecord<TProps = RewardProperties> {
|
|
|
259
281
|
journeyId?: string;
|
|
260
282
|
stageKey?: string;
|
|
261
283
|
}): ActionBuilder;
|
|
284
|
+
/**
|
|
285
|
+
* CreateCashbackRewardForOrderReferral
|
|
286
|
+
*
|
|
287
|
+
* Creates a new Reward record with the specified properties.
|
|
288
|
+
* Returns a builder with fluent .link*() methods for associations.
|
|
289
|
+
* Call .execute() to create or .dryRun() for debugging.
|
|
290
|
+
*
|
|
291
|
+
* @remarks Record type: CASHBACK
|
|
292
|
+
*
|
|
293
|
+
* @param properties - The properties for the new record
|
|
294
|
+
* @param options - Optional settings
|
|
295
|
+
* @param options.journeyId - Associate with a journey
|
|
296
|
+
* @param options.stageKey - Set initial pipeline stage
|
|
297
|
+
* @returns CreateCashbackRewardForOrderReferralBuilder - chain .link*() then .execute()
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const record = odinClient.rewards.new();
|
|
302
|
+
* await record.createCashbackRewardForOrderReferral({ ... })
|
|
303
|
+
* .linkAssociation_xxx(target)
|
|
304
|
+
* .execute();
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
createCashbackRewardForOrderReferral(properties: CreateCashbackRewardForOrderReferralProperties, options?: {
|
|
308
|
+
journeyId?: string;
|
|
309
|
+
stageKey?: string;
|
|
310
|
+
}): CreateCashbackRewardForOrderReferralBuilder;
|
|
262
311
|
/**
|
|
263
312
|
* MoveCashbackRewardToAwarded
|
|
264
313
|
*
|
|
@@ -32,10 +32,12 @@ exports.isRewardRecord = exports.RewardRecord = void 0;
|
|
|
32
32
|
const uuid_1 = require("uuid");
|
|
33
33
|
const core_1 = require("@d19n/odin-types/dist/core");
|
|
34
34
|
const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
|
|
35
|
+
const CreateCashbackRewardForOrderReferralDto_1 = require("../actions-v2/CreateCashbackRewardForOrderReferralDto");
|
|
35
36
|
const CampaignRecord_1 = require("./CampaignRecord");
|
|
36
37
|
const ContactRecord_1 = require("./ContactRecord");
|
|
37
38
|
const AffiliateCodeRecord_1 = require("./AffiliateCodeRecord");
|
|
38
39
|
const PaymentMethodRefundRecord_1 = require("./PaymentMethodRefundRecord");
|
|
40
|
+
const ReferralRecord_1 = require("./ReferralRecord");
|
|
39
41
|
/**
|
|
40
42
|
* Builder for action execution with dryRun support
|
|
41
43
|
*
|
|
@@ -285,6 +287,36 @@ class RewardRecord {
|
|
|
285
287
|
}
|
|
286
288
|
return this._paymentMethodRefunds;
|
|
287
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Access linked Referral records
|
|
292
|
+
* @remarks Available labels: OrderReferralCashbackReward
|
|
293
|
+
* @throws Error if called on a new (unsaved) record
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* // Get all linked Referral records
|
|
298
|
+
* const items = await record.referrals.list();
|
|
299
|
+
* const first = await record.referrals.first();
|
|
300
|
+
*
|
|
301
|
+
* // Filter by label
|
|
302
|
+
* const specific = await record.referrals.first({ label: 'OrderReferralCashbackReward' });
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
get referrals() {
|
|
306
|
+
var _a;
|
|
307
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
308
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
309
|
+
if (!this._referrals) {
|
|
310
|
+
this._referrals = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
311
|
+
sourceEntity: 'CrmModule:Reward',
|
|
312
|
+
targetEntity: 'CrmModule:Referral',
|
|
313
|
+
targetModuleName: 'CrmModule',
|
|
314
|
+
targetEntityName: 'Referral',
|
|
315
|
+
labels: ['OrderReferralCashbackReward'],
|
|
316
|
+
}, ReferralRecord_1.ReferralRecord);
|
|
317
|
+
}
|
|
318
|
+
return this._referrals;
|
|
319
|
+
}
|
|
288
320
|
// ============================================
|
|
289
321
|
// LINK MANAGEMENT
|
|
290
322
|
// ============================================
|
|
@@ -359,6 +391,32 @@ class RewardRecord {
|
|
|
359
391
|
};
|
|
360
392
|
return new ActionBuilder(this._provider, 'CrmModule', 'Reward', payload, () => { this._pendingLinks = []; });
|
|
361
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* CreateCashbackRewardForOrderReferral
|
|
396
|
+
*
|
|
397
|
+
* Creates a new Reward record with the specified properties.
|
|
398
|
+
* Returns a builder with fluent .link*() methods for associations.
|
|
399
|
+
* Call .execute() to create or .dryRun() for debugging.
|
|
400
|
+
*
|
|
401
|
+
* @remarks Record type: CASHBACK
|
|
402
|
+
*
|
|
403
|
+
* @param properties - The properties for the new record
|
|
404
|
+
* @param options - Optional settings
|
|
405
|
+
* @param options.journeyId - Associate with a journey
|
|
406
|
+
* @param options.stageKey - Set initial pipeline stage
|
|
407
|
+
* @returns CreateCashbackRewardForOrderReferralBuilder - chain .link*() then .execute()
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const record = odinClient.rewards.new();
|
|
412
|
+
* await record.createCashbackRewardForOrderReferral({ ... })
|
|
413
|
+
* .linkAssociation_xxx(target)
|
|
414
|
+
* .execute();
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
createCashbackRewardForOrderReferral(properties, options) {
|
|
418
|
+
return new CreateCashbackRewardForOrderReferralDto_1.CreateCashbackRewardForOrderReferralBuilder(properties || {}, [...this._pendingLinks], options).withProvider(this._provider, 'CrmModule', 'Reward', () => { this._pendingLinks = []; });
|
|
419
|
+
}
|
|
362
420
|
// ============================================
|
|
363
421
|
// UPDATE ACTIONS (require existing record)
|
|
364
422
|
// ============================================
|
|
@@ -433,6 +491,8 @@ RewardRecord.contactsLabels = ['ContactReward'];
|
|
|
433
491
|
RewardRecord.affiliateCodesLabels = ['AffiliateCodeRewards'];
|
|
434
492
|
/** Valid labels for PaymentMethodRefund associations */
|
|
435
493
|
RewardRecord.paymentMethodRefundsLabels = ['RewardPaymentMethodRefund'];
|
|
494
|
+
/** Valid labels for Referral associations */
|
|
495
|
+
RewardRecord.referralsLabels = ['OrderReferralCashbackReward'];
|
|
436
496
|
/** Type guard to check if an object is a RewardRecord */
|
|
437
497
|
function isRewardRecord(obj) {
|
|
438
498
|
return obj instanceof RewardRecord;
|