@builtbystack/sq-shopify-theme-sdk 0.0.8 → 0.0.9

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 CHANGED
@@ -334,14 +334,20 @@ CustomerRank は会員ランクを表す。
334
334
 
335
335
  > **calculationCondition**: [`CustomerRankCalculationCondition`](#type-aliasescustomerrankcalculationconditionmd)
336
336
 
337
+ この会員ランクを算出した際の条件
338
+
337
339
  #### earnedPointToRankUp
338
340
 
339
341
  > **earnedPointToRankUp**: `number`
340
342
 
343
+ ランクアップするために必要な残り獲得ポイント
344
+
341
345
  #### higherRank?
342
346
 
343
347
  > `optional` **higherRank**: [`CustomerRankRule`](#type-aliasescustomerrankrulemd)
344
348
 
349
+ この会員ランクの一段階上の会員ランク。上の会員ランクが存在しない場合はnull
350
+
345
351
  #### id
346
352
 
347
353
  > **id**: `string`
@@ -350,22 +356,32 @@ CustomerRank は会員ランクを表す。
350
356
 
351
357
  > `optional` **lowerRank**: [`CustomerRankRule`](#type-aliasescustomerrankrulemd)
352
358
 
359
+ この会員ランクの一段階下の会員ランク。下の会員ランクが存在しない場合はnull
360
+
353
361
  #### name
354
362
 
355
363
  > **name**: `string`
356
364
 
365
+ 会員ランク名
366
+
357
367
  #### pointMultiplier?
358
368
 
359
369
  > `optional` **pointMultiplier**: [`PointMultiplierCustomerRankRule`](#type-aliasespointmultipliercustomerrankrulemd)
360
370
 
371
+ この会員ランクの注文時ポイント倍率。ポイント設定がなかったり、ポイント設定があってもポイント倍率設定がなければnullが返る
372
+
361
373
  #### purchasePriceToRankUp
362
374
 
363
375
  > **purchasePriceToRankUp**: `number`
364
376
 
377
+ ランクアップするために必要な残り購入金額
378
+
365
379
  #### threshold
366
380
 
367
381
  > **threshold**: `number`
368
382
 
383
+ この会員ランクへのランクアップに必要な値。会員ランクの算出方法によりthresholdが指す値は異なり、獲得ポイントと購入金額のどちらかになる
384
+
369
385
 
370
386
  <a name="type-aliasescustomerrankcalculationconditionmd"></a>
371
387
 
@@ -387,14 +403,20 @@ CustomerRankCalculationCondition は会員ランクの算出条件を表す。
387
403
 
388
404
  > `optional` **customerRankCalculationPeriod**: [`CustomerRankCalculationPeriod`](#type-aliasescustomerrankcalculationperiodmd)
389
405
 
406
+ 会員ランク算出期間。期間が無期限の場合はnullを返す
407
+
390
408
  #### earnedPoint
391
409
 
392
410
  > **earnedPoint**: `number`
393
411
 
412
+ 会員ランクの算出根拠となる獲得ポイント
413
+
394
414
  #### purchasePrice
395
415
 
396
416
  > **purchasePrice**: `number`
397
417
 
418
+ 会員ランクの算出根拠となる購入金額
419
+
398
420
 
399
421
  <a name="type-aliasescustomerrankcalculationperiodmd"></a>
400
422
 
@@ -416,10 +438,14 @@ CustomerRankCalculationPeriod は会員ランクの算出期間を表す。
416
438
 
417
439
  > **end**: `Date`
418
440
 
441
+ 集計期間終了日
442
+
419
443
  #### start
420
444
 
421
445
  > **start**: `Date`
422
446
 
447
+ 集計期間開始日
448
+
423
449
 
424
450
  <a name="type-aliasescustomerrankrulemd"></a>
425
451
 
@@ -445,10 +471,14 @@ CustomerRankRule は会員ランクのルールを表す。
445
471
 
446
472
  > **name**: `string`
447
473
 
474
+ 会員ランク名
475
+
448
476
  #### threshold
449
477
 
450
478
  > **threshold**: `number`
451
479
 
480
+ この会員ランクへのランクアップに必要な値。会員ランクの算出方法によりthresholdが指す値は異なり、獲得ポイントと購入金額のどちらかになる。
481
+
452
482
 
453
483
  <a name="type-aliaseslocationmd"></a>
454
484
 
@@ -624,22 +654,33 @@ PointChange はポイントの変動を表す。
624
654
 
625
655
  > `optional` **availableAt**: `Date`
626
656
 
657
+ ポイントが利用可能になる日時。nilの場合はまだ利用可能になる日時が決まっていない。主に未配送注文に関するポイントはnilになる。
658
+
627
659
  #### availableUntil?
628
660
 
629
661
  > `optional` **availableUntil**: `Date`
630
662
 
663
+ ポイントが利用できる期限。失効する直前を表すため、expiresDateから1ナノ秒を引いた値となる。
664
+ 例えば、expiresDateが 2024-06-12 00:00:00 なら、availableUntilは 2024-06-11 23:59:59.999999999 となる。
665
+
631
666
  #### createdAt
632
667
 
633
668
  > **createdAt**: `Date`
634
669
 
670
+ PointChangeのコミットタイムスタンプ
671
+
635
672
  #### delta
636
673
 
637
674
  > **delta**: `number`
638
675
 
676
+ ポイント変動の数値。正負どちらの値も取りうる。
677
+
639
678
  #### expiresDate?
640
679
 
641
680
  > `optional` **expiresDate**: `Date`
642
681
 
682
+ ポイントの失効日。nilの場合はまだ失効日が決まっていない。ポイント消費や、未配送注文に関するポイントはnilになる。
683
+
643
684
  #### id
644
685
 
645
686
  > **id**: `string`
@@ -648,6 +689,8 @@ PointChange はポイントの変動を表す。
648
689
 
649
690
  > **pointChangeCreatedAt**: `Date`
650
691
 
692
+ ポイントの発生日時
693
+
651
694
 
652
695
  <a name="type-aliasespointchangeactivitiesmd"></a>
653
696
 
@@ -661,6 +704,8 @@ PointChange はポイントの変動を表す。
661
704
 
662
705
  > **PointChangeActivities**: `object`
663
706
 
707
+ PointChangeActivities はポイントの変動の履歴一覧を表す。
708
+
664
709
  ### Type declaration
665
710
 
666
711
  #### nodes
@@ -750,10 +795,14 @@ Points は SDK から取得できるポイントの情報を表す。
750
795
 
751
796
  > **pointsApproved**: `number`
752
797
 
798
+ PointsApproved は保有ポイントを表す。
799
+
753
800
  #### pointsPending
754
801
 
755
802
  > **pointsPending**: `number`
756
803
 
804
+ PointsPending は獲得予定ポイントを表す。
805
+
757
806
 
758
807
  <a name="type-aliasespurchasingcustomerdiscountmd"></a>
759
808
 
@@ -783,10 +832,24 @@ PurchasingCustomerDiscount は購入者の割引情報を表す。
783
832
 
784
833
  > **description**: `string`
785
834
 
835
+ #### endsAt
836
+
837
+ > **endsAt**: `Date`
838
+
786
839
  #### id
787
840
 
788
841
  > **id**: `string`
789
842
 
843
+ #### startsAt
844
+
845
+ > **startsAt**: `Date`
846
+
847
+ #### status
848
+
849
+ > **status**: `string`
850
+
851
+ Discountのステータス。"ACTIVE", "SCHEDULED", "EXPIRED" のいずれかが入る。
852
+
790
853
  #### title
791
854
 
792
855
  > **title**: `string`
@@ -808,7 +871,7 @@ PurchasingCustomerDiscount は購入者の割引情報を表す。
808
871
 
809
872
  > **PurchasingCustomerDiscounts**: `object`
810
873
 
811
- DiscountCodes は PurchasingCustomerDiscount の一覧を取得するための情報を表す。
874
+ PurchasingCustomerDiscounts は PurchasingCustomerDiscount の一覧を取得するための情報を表す。
812
875
 
813
876
  ### Type declaration
814
877
 
@@ -18,13 +18,37 @@ export declare type Address = {
18
18
  */
19
19
  export declare type CustomerRank = {
20
20
  id: string;
21
+ /**
22
+ * 会員ランク名
23
+ */
21
24
  name: string;
25
+ /**
26
+ * この会員ランクを算出した際の条件
27
+ */
22
28
  calculationCondition: CustomerRankCalculationCondition;
29
+ /**
30
+ * ランクアップするために必要な残り獲得ポイント
31
+ */
23
32
  earnedPointToRankUp: number;
33
+ /**
34
+ * この会員ランクの一段階上の会員ランク。上の会員ランクが存在しない場合はnull
35
+ */
24
36
  higherRank?: CustomerRankRule;
37
+ /**
38
+ * この会員ランクの一段階下の会員ランク。下の会員ランクが存在しない場合はnull
39
+ */
25
40
  lowerRank?: CustomerRankRule;
41
+ /**
42
+ * ランクアップするために必要な残り購入金額
43
+ */
26
44
  purchasePriceToRankUp: number;
45
+ /**
46
+ * この会員ランクへのランクアップに必要な値。会員ランクの算出方法によりthresholdが指す値は異なり、獲得ポイントと購入金額のどちらかになる
47
+ */
27
48
  threshold: number;
49
+ /**
50
+ * この会員ランクの注文時ポイント倍率。ポイント設定がなかったり、ポイント設定があってもポイント倍率設定がなければnullが返る
51
+ */
28
52
  pointMultiplier?: PointMultiplierCustomerRankRule;
29
53
  };
30
54
 
@@ -32,8 +56,17 @@ export declare type CustomerRank = {
32
56
  * CustomerRankCalculationCondition は会員ランクの算出条件を表す。
33
57
  */
34
58
  export declare type CustomerRankCalculationCondition = {
59
+ /**
60
+ * 会員ランク算出期間。期間が無期限の場合はnullを返す
61
+ */
35
62
  customerRankCalculationPeriod?: CustomerRankCalculationPeriod;
63
+ /**
64
+ * 会員ランクの算出根拠となる獲得ポイント
65
+ */
36
66
  earnedPoint: number;
67
+ /**
68
+ * 会員ランクの算出根拠となる購入金額
69
+ */
37
70
  purchasePrice: number;
38
71
  };
39
72
 
@@ -41,7 +74,13 @@ export declare type CustomerRankCalculationCondition = {
41
74
  * CustomerRankCalculationPeriod は会員ランクの算出期間を表す。
42
75
  */
43
76
  export declare type CustomerRankCalculationPeriod = {
77
+ /**
78
+ * 集計期間開始日
79
+ */
44
80
  start: Date;
81
+ /**
82
+ * 集計期間終了日
83
+ */
45
84
  end: Date;
46
85
  };
47
86
 
@@ -50,7 +89,13 @@ export declare type CustomerRankCalculationPeriod = {
50
89
  */
51
90
  export declare type CustomerRankRule = {
52
91
  id: string;
92
+ /**
93
+ * 会員ランク名
94
+ */
53
95
  name: string;
96
+ /**
97
+ * この会員ランクへのランクアップに必要な値。会員ランクの算出方法によりthresholdが指す値は異なり、獲得ポイントと購入金額のどちらかになる。
98
+ */
54
99
  threshold: number;
55
100
  };
56
101
 
@@ -123,16 +168,35 @@ export declare type PageInfo = {
123
168
  */
124
169
  export declare type PointChange = {
125
170
  id: string;
171
+ /**
172
+ * ポイント変動の数値。正負どちらの値も取りうる。
173
+ */
126
174
  delta: number;
175
+ /**
176
+ * ポイントが利用可能になる日時。nilの場合はまだ利用可能になる日時が決まっていない。主に未配送注文に関するポイントはnilになる。
177
+ */
127
178
  availableAt?: Date;
179
+ /**
180
+ * ポイントが利用できる期限。失効する直前を表すため、expiresDateから1ナノ秒を引いた値となる。
181
+ * 例えば、expiresDateが 2024-06-12 00:00:00 なら、availableUntilは 2024-06-11 23:59:59.999999999 となる。
182
+ */
128
183
  availableUntil?: Date;
184
+ /**
185
+ * ポイントの失効日。nilの場合はまだ失効日が決まっていない。ポイント消費や、未配送注文に関するポイントはnilになる。
186
+ */
129
187
  expiresDate?: Date;
188
+ /**
189
+ * ポイントの発生日時
190
+ */
130
191
  pointChangeCreatedAt: Date;
192
+ /**
193
+ * PointChangeのコミットタイムスタンプ
194
+ */
131
195
  createdAt: Date;
132
196
  };
133
197
 
134
198
  /**
135
- *
199
+ * PointChangeActivities はポイントの変動の履歴一覧を表す。
136
200
  */
137
201
  export declare type PointChangeActivities = {
138
202
  nodes: PointChangeActivity[];
@@ -154,7 +218,7 @@ declare enum PointChangeActivitySortKey {
154
218
  }
155
219
 
156
220
  /**
157
- * PointMultiplierCustomerRankRule はこの会員ランクの注文時ポイント倍率を表す。
221
+ * PointMultiplierCustomerRankRule はこの会員ランクの注文時ポイント倍率を表す。
158
222
  */
159
223
  export declare type PointMultiplierCustomerRankRule = {
160
224
  id: string;
@@ -166,7 +230,13 @@ export declare type PointMultiplierCustomerRankRule = {
166
230
  * Points は SDK から取得できるポイントの情報を表す。
167
231
  */
168
232
  export declare type Points = {
233
+ /**
234
+ * PointsApproved は保有ポイントを表す。
235
+ */
169
236
  pointsApproved: number;
237
+ /**
238
+ * PointsPending は獲得予定ポイントを表す。
239
+ */
170
240
  pointsPending: number;
171
241
  };
172
242
 
@@ -177,13 +247,19 @@ export declare type PurchasingCustomerDiscount = {
177
247
  id: string;
178
248
  title: string;
179
249
  description: string;
250
+ /**
251
+ * Discountのステータス。"ACTIVE", "SCHEDULED", "EXPIRED" のいずれかが入る。
252
+ */
253
+ status: string;
180
254
  code: string;
255
+ startsAt: Date;
256
+ endsAt: Date;
181
257
  createdAt: Date;
182
258
  updatedAt: Date;
183
259
  };
184
260
 
185
261
  /**
186
- * DiscountCodes は PurchasingCustomerDiscount の一覧を取得するための情報を表す。
262
+ * PurchasingCustomerDiscounts は PurchasingCustomerDiscount の一覧を取得するための情報を表す。
187
263
  */
188
264
  export declare type PurchasingCustomerDiscounts = {
189
265
  id: string;
@@ -3240,8 +3240,11 @@ const P = q, nn = P`
3240
3240
  nodes {
3241
3241
  id
3242
3242
  title
3243
+ status
3243
3244
  description
3244
3245
  code
3246
+ startsAt
3247
+ endsAt
3245
3248
  createdAt
3246
3249
  updatedAt
3247
3250
  }
@@ -3504,8 +3507,11 @@ class fn {
3504
3507
  (s) => ({
3505
3508
  id: s.id,
3506
3509
  title: s.title,
3510
+ status: s.status,
3507
3511
  description: s.description,
3508
3512
  code: s.code,
3513
+ startsAt: new Date(s.startsAt),
3514
+ endsAt: new Date(s.endsAt),
3509
3515
  createdAt: new Date(s.createdAt),
3510
3516
  updatedAt: new Date(s.updatedAt)
3511
3517
  })
@@ -162,8 +162,11 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
162
162
  nodes {
163
163
  id
164
164
  title
165
+ status
165
166
  description
166
167
  code
168
+ startsAt
169
+ endsAt
167
170
  createdAt
168
171
  updatedAt
169
172
  }
@@ -247,4 +250,4 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
247
250
  }
248
251
  }
249
252
  }
250
- `,an=(e,t,n,i)=>e();function cn(e,t=an){return{GetLocationAvailabilities(n,i){return t(r=>e.request(Zt,n,{...i,...r}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,i){return t(r=>e.request(Kt,n,{...i,...r}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,i){return t(r=>e.request(en,n,{...i,...r}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,i){return t(r=>e.request(tn,n,{...i,...r}),"GetPoints","query",n)},GetLocations(n,i){return t(r=>e.request(nn,n,{...i,...r}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,i){return t(r=>e.request(rn,n,{...i,...r}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerPointChangeActivities(n,i){return t(r=>e.request(sn,n,{...i,...r}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,i){return t(r=>e.request(on,n,{...i,...r}),"GetPurchasingCustomerRank","query",n)}}}class un{constructor(t){$e(this,"api");this.api=cn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,i,r){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:i,isReverse:r});return{nodes:s.locationAvailabilities.nodes.map(o=>({location:{id:o.location.id,name:o.location.name,phone:o.location.phone,address:o.location.address?{id:o.location.address.id,countryCode:o.location.address.countryCode,country:o.location.address.country,postalCode:o.location.address.postalCode,provinceCode:o.location.address.provinceCode,province:o.location.address.province,city:o.location.address.city,address1:o.location.address.address1,address2:o.location.address.address2}:void 0},inventoryQuantity:o.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const i=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{id:i.locationAvailability.location.id,name:i.locationAvailability.location.name,phone:i.locationAvailability.location.phone,address:i.locationAvailability.location.address?{id:i.locationAvailability.location.address.id,countryCode:i.locationAvailability.location.address.countryCode,country:i.locationAvailability.location.address.country,postalCode:i.locationAvailability.location.address.postalCode,provinceCode:i.locationAvailability.location.address.provinceCode,province:i.locationAvailability.location.address.province,city:i.locationAvailability.location.address.city,address1:i.locationAvailability.location.address.address1,address2:i.locationAvailability.location.address.address2}:void 0},inventoryQuantity:i.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,i){const r=await this.api.GetLocations({first:t,after:n,isReverse:i});return{nodes:r.locations.nodes.map(s=>({id:s.id,name:s.name,phone:s.phone,address:s.address?{id:s.address.id,countryCode:s.address.countryCode,country:s.address.country,postalCode:s.address.postalCode,provinceCode:s.address.provinceCode,province:s.address.province,city:s.address.city,address1:s.address.address1,address2:s.address.address2}:void 0}))??[],pageInfo:r.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,i){const r=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:i});return r.purchasingCustomer?{id:r.purchasingCustomer.id,nodes:r.purchasingCustomer.discounts.nodes.map(s=>({id:s.id,title:s.title,description:s.description,code:s.code,createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:r.purchasingCustomer.discounts.pageInfo??null}:null}async getPointChangeActivities(t,n,i,r){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:i,sortKeys:r});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(o=>({id:o.id,title:o.title,pointChange:{id:o.pointChange.id,delta:o.pointChange.delta,availableAt:o.pointChange.availableAt?new Date(o.pointChange.availableAt):void 0,availableUntil:o.pointChange.availableUntil?new Date(o.pointChange.availableUntil):void 0,expiresDate:o.pointChange.expiresDate?new Date(o.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(o.pointChange.pointChangeCreatedAt),createdAt:new Date(o.pointChange.createdAt)}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}}R.SDK=un,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
253
+ `,an=(e,t,n,i)=>e();function cn(e,t=an){return{GetLocationAvailabilities(n,i){return t(r=>e.request(Zt,n,{...i,...r}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,i){return t(r=>e.request(Kt,n,{...i,...r}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,i){return t(r=>e.request(en,n,{...i,...r}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,i){return t(r=>e.request(tn,n,{...i,...r}),"GetPoints","query",n)},GetLocations(n,i){return t(r=>e.request(nn,n,{...i,...r}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,i){return t(r=>e.request(rn,n,{...i,...r}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerPointChangeActivities(n,i){return t(r=>e.request(sn,n,{...i,...r}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,i){return t(r=>e.request(on,n,{...i,...r}),"GetPurchasingCustomerRank","query",n)}}}class un{constructor(t){$e(this,"api");this.api=cn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,i,r){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:i,isReverse:r});return{nodes:s.locationAvailabilities.nodes.map(o=>({location:{id:o.location.id,name:o.location.name,phone:o.location.phone,address:o.location.address?{id:o.location.address.id,countryCode:o.location.address.countryCode,country:o.location.address.country,postalCode:o.location.address.postalCode,provinceCode:o.location.address.provinceCode,province:o.location.address.province,city:o.location.address.city,address1:o.location.address.address1,address2:o.location.address.address2}:void 0},inventoryQuantity:o.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const i=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{id:i.locationAvailability.location.id,name:i.locationAvailability.location.name,phone:i.locationAvailability.location.phone,address:i.locationAvailability.location.address?{id:i.locationAvailability.location.address.id,countryCode:i.locationAvailability.location.address.countryCode,country:i.locationAvailability.location.address.country,postalCode:i.locationAvailability.location.address.postalCode,provinceCode:i.locationAvailability.location.address.provinceCode,province:i.locationAvailability.location.address.province,city:i.locationAvailability.location.address.city,address1:i.locationAvailability.location.address.address1,address2:i.locationAvailability.location.address.address2}:void 0},inventoryQuantity:i.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,i){const r=await this.api.GetLocations({first:t,after:n,isReverse:i});return{nodes:r.locations.nodes.map(s=>({id:s.id,name:s.name,phone:s.phone,address:s.address?{id:s.address.id,countryCode:s.address.countryCode,country:s.address.country,postalCode:s.address.postalCode,provinceCode:s.address.provinceCode,province:s.address.province,city:s.address.city,address1:s.address.address1,address2:s.address.address2}:void 0}))??[],pageInfo:r.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,i){const r=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:i});return r.purchasingCustomer?{id:r.purchasingCustomer.id,nodes:r.purchasingCustomer.discounts.nodes.map(s=>({id:s.id,title:s.title,status:s.status,description:s.description,code:s.code,startsAt:new Date(s.startsAt),endsAt:new Date(s.endsAt),createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:r.purchasingCustomer.discounts.pageInfo??null}:null}async getPointChangeActivities(t,n,i,r){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:i,sortKeys:r});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(o=>({id:o.id,title:o.title,pointChange:{id:o.pointChange.id,delta:o.pointChange.delta,availableAt:o.pointChange.availableAt?new Date(o.pointChange.availableAt):void 0,availableUntil:o.pointChange.availableUntil?new Date(o.pointChange.availableUntil):void 0,expiresDate:o.pointChange.expiresDate?new Date(o.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(o.pointChange.pointChangeCreatedAt),createdAt:new Date(o.pointChange.createdAt)}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}}R.SDK=un,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builtbystack/sq-shopify-theme-sdk",
3
3
  "private": false,
4
- "version": "0.0.8",
4
+ "version": "0.0.9",
5
5
  "files": [
6
6
  "dist"
7
7
  ],